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 java.util.ArrayList;
23  import java.util.List;
24  
25  import junit.framework.TestCase;
26  
27  /**
28   *
29   */
30  public class ReportTestSuiteTest
31      extends TestCase
32  {
33      private ReportTestSuite tSuite;
34  
35      /**
36       * {@inheritDoc}
37       */
38      protected void setUp()
39          throws Exception
40      {
41          super.setUp();
42          tSuite = new ReportTestSuite();
43      }
44  
45      public void testSetTestCases()
46      {
47          ReportTestCase tCase = new ReportTestCase();
48  
49          List<ReportTestCase> tCaseList = new ArrayList<ReportTestCase>();
50  
51          tCaseList.add( tCase );
52  
53          tSuite.setTestCases( tCaseList );
54  
55          assertEquals( tCase, tSuite.getTestCases().get( 0 ) );
56      }
57  
58      public void testSetNumberedOfErrors()
59      {
60          tSuite.setNumberOfErrors( 9 );
61  
62          assertEquals( 9, tSuite.getNumberOfErrors() );
63      }
64  
65      public void testSetNumberOfFailures()
66      {
67          tSuite.setNumberOfFailures( 10 );
68  
69          assertEquals( 10, tSuite.getNumberOfFailures() );
70      }
71  
72      public void testSetNumberOfSkipped()
73      {
74          tSuite.setNumberOfSkipped( 5 );
75  
76          assertEquals( 5, tSuite.getNumberOfSkipped() );
77      }
78  
79      public void testSetNumberOfTests()
80      {
81          tSuite.setNumberOfTests( 11 );
82  
83          assertEquals( 11, tSuite.getNumberOfTests() );
84      }
85  
86      public void testSetName()
87      {
88          tSuite.setName( "Suite Name" );
89  
90          assertEquals( "Suite Name", tSuite.getName() );
91      }
92  
93      public void testSetPackageName()
94      {
95          tSuite.setPackageName( "Suite Package Name" );
96  
97          assertEquals( "Suite Package Name", tSuite.getPackageName() );
98      }
99  
100     public void testSetTimeElapsed()
101     {
102         tSuite.setTimeElapsed( .06f );
103 
104         assertEquals( .06f, tSuite.getTimeElapsed(), 0.0 );
105     }
106 }