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 java.io.IOException;
23 import java.net.URI;
24
25 import org.apache.maven.surefire.its.fixture.*;
26
27 import com.gargoylesoftware.htmlunit.WebClient;
28 import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
29 import com.gargoylesoftware.htmlunit.html.HtmlDivision;
30 import com.gargoylesoftware.htmlunit.html.HtmlPage;
31 import org.junit.Test;
32
33 import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
34 import static org.junit.Assert.assertFalse;
35 import static org.junit.Assert.assertNotNull;
36 import static org.junit.Assert.assertTrue;
37
38
39
40
41
42
43 public class Surefire260TestWithIdenticalNamesIT
44 extends SurefireJUnit4IntegrationTestCase
45 {
46
47 @Test
48 public void testWithIdenticalNames()
49 throws IOException
50 {
51 assumeJavaVersion( 1.8d );
52 OutputValidator validator = unpack( "surefire-260-testWithIdenticalNames" )
53 .failNever()
54 .addGoal( "site" )
55 .addSurefireReportGoal()
56 .executeCurrentGoals();
57
58 TestFile siteFile = validator.getSiteFile( "surefire-report.html" );
59 final URI uri = siteFile.toURI();
60
61 try ( WebClient webClient = new WebClient() )
62 {
63 HtmlPage page = webClient.getPage( uri.toURL() );
64 HtmlAnchor a = ( HtmlAnchor ) page.getByXPath(
65 "//a[@href = \"javascript:toggleDisplay('surefire260.TestB.testDup');\"]" )
66 .get( 0 );
67 HtmlDivision content = ( HtmlDivision ) page.getElementById( "surefire260.TestB.testDup-failure" );
68 assertNotNull( content );
69 assertTrue( content.getAttribute( "style" ).contains( "none" ) );
70 a.click();
71 assertFalse( content.getAttribute( "style" ).contains( "none" ) );
72 }
73 }
74 }