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