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  
43          tSuite = new ReportTestSuite();
44      }
45  
46      /**
47       * {@inheritDoc}
48       */
49      protected void tearDown()
50          throws Exception
51      {
52          super.tearDown();
53  
54          tSuite = null;
55      }
56  
57      public void testSetTestCases()
58      {
59          ReportTestCase tCase = new ReportTestCase();
60  
61          List<ReportTestCase> tCaseList = new ArrayList<ReportTestCase>();
62  
63          tCaseList.add( tCase );
64  
65          tSuite.setTestCases( tCaseList );
66  
67          assertEquals( tCase, tSuite.getTestCases().get( 0 ) );
68      }
69  
70      public void testSetNumberdOfErrors()
71      {
72          tSuite.setNumberOfErrors( 9 );
73  
74          assertEquals( 9, tSuite.getNumberOfErrors() );
75      }
76  
77      public void testSetNumberOfFailures()
78      {
79          tSuite.setNumberOfFailures( 10 );
80  
81          assertEquals( 10, tSuite.getNumberOfFailures() );
82      }
83  
84      public void testSetNumberOfSkipped()
85      {
86          tSuite.setNumberOfSkipped( 5 );
87  
88          assertEquals( 5, tSuite.getNumberOfSkipped() );
89      }
90  
91      public void testSetNumberOfTests()
92      {
93          tSuite.setNumberOfTests( 11 );
94  
95          assertEquals( 11, tSuite.getNumberOfTests() );
96      }
97  
98      public void testSetName()
99      {
100         tSuite.setName( "Suite Name" );
101 
102         assertEquals( "Suite Name", tSuite.getName() );
103     }
104 
105     public void testSetPackageName()
106     {
107         tSuite.setPackageName( "Suite Package Name" );
108 
109         assertEquals( "Suite Package Name", tSuite.getPackageName() );
110     }
111 
112     public void testSetTimeElapsed()
113     {
114         tSuite.setTimeElapsed( .06f );
115 
116         assertEquals( .06f, tSuite.getTimeElapsed(), 0.0 );
117     }
118 }