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