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.io.File;
30 import java.util.List;
31
32 import static org.junit.Assert.assertEquals;
33
34
35
36
37
38
39 public class Surefire224WellFormedXmlFailuresIT
40 extends SurefireJUnit4IntegrationTestCase
41 {
42 @SuppressWarnings("ConstantConditions")
43 @Test
44 public void testWellFormedXmlFailures()
45 {
46 OutputValidator outputValidator = unpack( "/surefire-224-wellFormedXmlFailures" ).executeTest();
47
48 outputValidator.assertTestSuiteResults( 4, 0, 4, 0 );
49
50 ReportTestSuite suite =
51 HelperAssertions.extractReports( ( new File[]{ outputValidator.getBaseDir() } ) ).get( 0 );
52 List<org.apache.maven.plugins.surefire.report.ReportTestCase> testCases = suite.getTestCases();
53 assertEquals( "Wrong number of test case objects", 4, testCases.size() );
54 ReportTestCase testQuote = null, testLower = null, testGreater = null, testU0000 = null;
55 for ( ReportTestCase current : testCases )
56 {
57 if ( "testQuote".equals( current.getName() ) )
58 {
59 testQuote = current;
60 }
61 else if ( "testLower".equals( current.getName() ) )
62 {
63 testLower = current;
64 }
65 else if ( "testGreater".equals( current.getName() ) )
66 {
67 testGreater = current;
68 }
69 else if ( "testU0000".equals( current.getName() ) )
70 {
71 testU0000 = current;
72 }
73 }
74 assertEquals( "Wrong error message", "\"", testQuote.getFailure().get( "message" ) );
75 assertEquals( "Wrong error message", "<", testLower.getFailure().get( "message" ) );
76 assertEquals( "Wrong error message", ">", testGreater.getFailure().get( "message" ) );
77
78 assertEquals( "Wrong error message", "�", testU0000.getFailure().get( "message" ) );
79 }
80 }