1 package org.apache.maven.plugin.surefire.report;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import org.apache.maven.surefire.report.ReportEntry;
22 import org.apache.maven.surefire.report.SimpleReportEntry;
23
24 import junit.framework.TestCase;
25
26
27
28
29 public class WrappedReportEntryTest
30 extends TestCase
31 {
32
33 public void testClassNameOnly()
34 throws Exception
35 {
36 String category = "surefire.testcase.JunitParamsTest";
37 WrappedReportEntry wr =
38 new WrappedReportEntry( new SimpleReportEntry( "fud", category ), null, 12, null, null );
39 final String reportName = wr.getReportName();
40 assertEquals( "surefire.testcase.JunitParamsTest", reportName );
41 }
42
43 public void testRegular()
44 {
45 ReportEntry reportEntry = new SimpleReportEntry( "fud", "testSum(surefire.testcase.NonJunitParamsTest)" );
46 WrappedReportEntry wr = new WrappedReportEntry( reportEntry, null, 12, null, null );
47 final String reportName = wr.getReportName();
48 assertEquals( "testSum", reportName );
49 }
50
51 public void testGetReportNameWithParams()
52 throws Exception
53 {
54 String category = "[0] 1\u002C 2\u002C 3 (testSum)(surefire.testcase.JunitParamsTest)";
55 ReportEntry reportEntry = new SimpleReportEntry( "fud", category );
56 WrappedReportEntry wr = new WrappedReportEntry( reportEntry, null, 12, null, null );
57 final String reportName = wr.getReportName();
58 assertEquals( "[0] 1, 2, 3 (testSum)", reportName );
59 }
60
61 public void testElapsed()
62 throws Exception
63 {
64 String category = "[0] 1\u002C 2\u002C 3 (testSum)(surefire.testcase.JunitParamsTest)";
65 ReportEntry reportEntry = new SimpleReportEntry( "fud", category );
66 WrappedReportEntry wr = new WrappedReportEntry( reportEntry, null, 12, null, null );
67 String elapsedTimeSummary = wr.getElapsedTimeSummary();
68 assertEquals( "[0] 1, 2, 3 (testSum)(surefire.testcase.JunitParamsTest) Time elapsed: 0.012 sec",
69 elapsedTimeSummary );
70 }
71
72
73 }