1 package org.apache.maven.surefire.its.jiras;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.plugins.surefire.report.ReportTestCase;
23 import org.apache.maven.plugins.surefire.report.ReportTestSuite;
24 import org.apache.maven.surefire.its.fixture.HelperAssertions;
25 import org.apache.maven.surefire.its.fixture.OutputValidator;
26 import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
27 import org.junit.Test;
28
29 import java.util.List;
30
31 import static org.junit.Assert.assertEquals;
32
33
34
35
36
37
38 public class Surefire224WellFormedXmlFailuresIT
39 extends SurefireJUnit4IntegrationTestCase
40 {
41 @SuppressWarnings("ConstantConditions")
42 @Test
43 public void testWellFormedXmlFailures()
44 {
45 OutputValidator outputValidator = unpack( "/surefire-224-wellFormedXmlFailures" ).executeTest();
46
47 outputValidator.assertTestSuiteResults( 4, 0, 4, 0 );
48
49 ReportTestSuite suite = HelperAssertions.extractReports( outputValidator.getBaseDir() ).get( 0 );
50 List<org.apache.maven.plugins.surefire.report.ReportTestCase> testCases = suite.getTestCases();
51 assertEquals( "Wrong number of test case objects", 4, testCases.size() );
52 ReportTestCase testQuote = null, testLower = null, testGreater = null, testU0000 = null;
53 for ( ReportTestCase current : testCases )
54 {
55 if ( "testQuote".equals( current.getName() ) )
56 {
57 testQuote = current;
58 }
59 else if ( "testLower".equals( current.getName() ) )
60 {
61 testLower = current;
62 }
63 else if ( "testGreater".equals( current.getName() ) )
64 {
65 testGreater = current;
66 }
67 else if ( "testU0000".equals( current.getName() ) )
68 {
69 testU0000 = current;
70 }
71 }
72 assertEquals( "Wrong error message", "\"", testQuote.getFailureMessage() );
73 assertEquals( "Wrong error message", "<", testLower.getFailureMessage() );
74 assertEquals( "Wrong error message", ">", testGreater.getFailureMessage() );
75
76 assertEquals( "Wrong error message", "�", testU0000.getFailureMessage() );
77 }
78 }