View Javadoc

1   package org.apache.maven.plugins.surefire.report;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import junit.framework.TestCase;
23  
24  import java.util.ArrayList;
25  import java.util.List;
26  
27  /**
28   * @version $Id: ReportTestSuiteTest.java 803879 2009-08-13 13:43:01Z vsiveton $
29   */
30  public class ReportTestSuiteTest
31      extends TestCase
32  {
33      private ReportTestSuite tSuite;
34  
35      /** {@inheritDoc} */
36      protected void setUp()
37          throws Exception
38      {
39          super.setUp();
40  
41          tSuite = new ReportTestSuite();
42      }
43  
44      /** {@inheritDoc} */
45      protected void tearDown()
46          throws Exception
47      {
48          super.tearDown();
49  
50          tSuite = null;
51      }
52  
53      public void testSetTestCases()
54      {
55          ReportTestCase tCase = new ReportTestCase();
56  
57          List tCaseList = new ArrayList();
58  
59          tCaseList.add( tCase );
60  
61          tSuite.setTestCases( tCaseList );
62  
63          assertEquals( tCase, tSuite.getTestCases().get( 0 ) );
64      }
65  
66      public void testSetNumberdOfErrors()
67      {
68          tSuite.setNumberOfErrors( 9 );
69  
70          assertEquals( 9, tSuite.getNumberOfErrors() );
71      }
72  
73      public void testSetNumberOfFailures()
74      {
75          tSuite.setNumberOfFailures( 10 );
76  
77          assertEquals( 10, tSuite.getNumberOfFailures() );
78      }
79  
80      public void testSetNumberOfSkipped()
81      {
82          tSuite.setNumberOfSkipped( 5 );
83  
84          assertEquals( 5, tSuite.getNumberOfSkipped() );
85      }
86  
87      public void testSetNumberOfTests()
88      {
89          tSuite.setNumberOfTests( 11 );
90  
91          assertEquals( 11, tSuite.getNumberOfTests() );
92      }
93  
94      public void testSetName()
95      {
96          tSuite.setName( "Suite Name" );
97  
98          assertEquals( "Suite Name", tSuite.getName() );
99      }
100 
101     public void testSetPackageName()
102     {
103         tSuite.setPackageName( "Suite Package Name" );
104 
105         assertEquals( "Suite Package Name", tSuite.getPackageName() );
106     }
107 
108     public void testSetTimeElapsed()
109     {
110         tSuite.setTimeElapsed( .06f );
111 
112         assertEquals( .06f, tSuite.getTimeElapsed(), 0.0 );
113     }
114 }