1 package org.apache.maven.surefire.report;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import junit.framework.TestCase;
23
24
25
26
27
28
29
30 public abstract class AbstractConsoleReporterTestCase
31 extends TestCase
32 {
33
34 private AbstractConsoleReporter consoleReporter;
35
36 private ReportEntry report;
37
38 protected void setUp()
39 throws Exception
40 {
41 super.setUp();
42 report = CategorizedReportEntry.nameGroup( "name", "group" );
43 }
44
45 protected void setConsoleReporter( AbstractConsoleReporter consoleReporter )
46 {
47 this.consoleReporter = consoleReporter;
48 }
49
50 protected AbstractConsoleReporter getConsoleReporter()
51 {
52 return consoleReporter;
53 }
54
55 public void testTestSetStarting()
56 throws Exception
57 {
58 consoleReporter.testSetStarting( report );
59 }
60
61 public void testGetTestSetStartingMessage()
62 throws Exception
63 {
64 String message = AbstractConsoleReporter.getTestSetStartingMessage( report );
65 assertEquals( "Running name (of group)", message );
66
67 report = CategorizedReportEntry.nameGroup( "name", null );
68
69 message = AbstractConsoleReporter.getTestSetStartingMessage( report );
70 assertEquals( "Running name", message );
71 }
72
73 public void testParseTestSetStartingMessage()
74 throws Exception
75 {
76 String message = "Running name (of group)";
77 ReportEntry actualReport = AbstractConsoleReporter.parseTestSetStartingMessage( message );
78 assertEquals( report, actualReport );
79 }
80
81 public void testIsTestSetStartingMessage()
82 throws Exception
83 {
84 String message = "Running name (of group)";
85 assertTrue( AbstractConsoleReporter.isTestSetStartingMessage( message ) );
86
87 message = "Running name";
88 assertTrue( AbstractConsoleReporter.isTestSetStartingMessage( message ) );
89
90 message = "Xxxx";
91 assertFalse( AbstractConsoleReporter.isTestSetStartingMessage( message ) );
92 }
93
94 }