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