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.surefire.api.report;
20  
21  import static org.apache.maven.surefire.api.report.RunMode.NORMAL_RUN;
22  import static org.junit.Assert.assertEquals;
23  
24  /**
25   * @author Ashley Scopes
26   */
27  public class CategorizedReportEntryTest {
28      public void testGetReportNameWithGroupWhenSourceTextIsNull() {
29          String className = "ClassName";
30          String classText = null;
31          String groupName = "The Group Name";
32          ReportEntry reportEntry =
33                  new CategorizedReportEntry(NORMAL_RUN, 1L, className, classText, groupName, null, null);
34          assertEquals("ClassName (of The Group Name)", reportEntry.getReportNameWithGroup());
35      }
36  
37      public void testGetReportNameWithGroupWhenSourceTextIsEmpty() {
38          String className = "ClassName";
39          String classText = "";
40          String groupName = "The Group Name";
41          ReportEntry reportEntry =
42                  new CategorizedReportEntry(NORMAL_RUN, 1L, className, classText, groupName, null, null);
43          assertEquals("ClassName (of The Group Name)", reportEntry.getReportNameWithGroup());
44      }
45  
46      public void testGetReportNameWithGroupWhenSourceTextIsBlank() {
47          String className = "ClassName";
48          String classText = "  ";
49          String groupName = "The Group Name";
50          ReportEntry reportEntry =
51                  new CategorizedReportEntry(NORMAL_RUN, 1L, className, classText, groupName, null, null);
52          assertEquals("ClassName (of The Group Name)", reportEntry.getReportNameWithGroup());
53      }
54  
55      public void testGetReportNameWithGroupWhenSourceTextIsProvided() {
56          String className = "ClassName";
57          String classText = "The Class Name";
58          String groupName = "The Group Name";
59          ReportEntry reportEntry =
60                  new CategorizedReportEntry(NORMAL_RUN, 1L, className, classText, groupName, null, null);
61          assertEquals("The Class Name (of The Group Name)", reportEntry.getReportNameWithGroup());
62      }
63  }