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 import junit.framework.TestCase;
20
21 /**
22 * Test for AbstractConsoleReporter
23 *
24 * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
25 * @version $Id: AbstractConsoleReporterTest.java 415196 2006-06-18 21:11:24Z carlos $
26 */
27 public class AbstractConsoleReporterTest
28 extends TestCase
29 {
30
31 private AbstractConsoleReporter consoleReporter;
32
33 private ReportEntry report;
34
35 protected void setUp()
36 throws Exception
37 {
38 super.setUp();
39 report = new ReportEntry();
40 report.setGroup( "group" );
41 report.setName( "name" );
42 }
43
44 protected void setConsoleReporter( AbstractConsoleReporter consoleReporter )
45 {
46 this.consoleReporter = consoleReporter;
47 }
48
49 protected AbstractConsoleReporter getConsoleReporter()
50 {
51 return consoleReporter;
52 }
53
54 public void testTestSetStarting()
55 throws Exception
56 {
57 consoleReporter.testSetStarting( report );
58 }
59
60 public void testGetTestSetStartingMessage()
61 throws Exception
62 {
63 String message = AbstractConsoleReporter.getTestSetStartingMessage( report );
64 assertEquals( "Running name (of group)", message );
65
66 report.setGroup( null );
67 message = AbstractConsoleReporter.getTestSetStartingMessage( report );
68 assertEquals( "Running name", message );
69 }
70
71 public void testParseTestSetStartingMessage()
72 throws Exception
73 {
74 String message = "Running name (of group)";
75 ReportEntry actualReport = AbstractConsoleReporter.parseTestSetStartingMessage( message );
76 assertEquals( report, actualReport );
77
78 report.setGroup( null );
79 message = "Running name";
80 actualReport = AbstractConsoleReporter.parseTestSetStartingMessage( message );
81 assertEquals( report, actualReport );
82 }
83
84 public void testIsTestSetStartingMessage()
85 throws Exception
86 {
87 String message = "Running name (of group)";
88 assertTrue( AbstractConsoleReporter.isTestSetStartingMessage( message ) );
89
90 message = "Running name";
91 assertTrue( AbstractConsoleReporter.isTestSetStartingMessage( message ) );
92
93 message = "Xxxx";
94 assertFalse( AbstractConsoleReporter.isTestSetStartingMessage( message ) );
95 }
96
97 }