1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.report.projectinfo;
20
21 import java.net.URL;
22
23 import com.meterware.httpunit.GetMethodWebRequest;
24 import com.meterware.httpunit.TextBlock;
25 import com.meterware.httpunit.WebConversation;
26 import com.meterware.httpunit.WebRequest;
27 import com.meterware.httpunit.WebResponse;
28
29
30
31
32
33
34 public class DependencyConvergenceReportTest extends AbstractProjectInfoTestCase {
35
36
37
38 private static final WebConversation WEB_CONVERSATION = new WebConversation();
39
40
41
42
43
44
45 public void testReport() throws Exception {
46 generateReport(getGoal(), "dependency-convergence-plugin-config.xml");
47 assertTrue(
48 "Test html generated",
49 getGeneratedReport("dependency-convergence.html").exists());
50
51 URL reportURL =
52 getGeneratedReport("dependency-convergence.html").toURI().toURL();
53 assertNotNull(reportURL);
54
55
56 WebRequest request = new GetMethodWebRequest(reportURL.toString());
57 WebResponse response = WEB_CONVERSATION.getResponse(request);
58
59
60 assertTrue(response.isHTML());
61 assertTrue(response.getContentLength() > 0);
62
63
64 String expectedTitle = prepareTitle(
65 "dependency convergence project info", getString("report.dependency-convergence.reactor.title"));
66 assertEquals(expectedTitle, response.getTitle());
67
68
69 TextBlock[] textBlocks = response.getTextBlocks();
70 assertEquals(getString("report.dependency-convergence.reactor.name"), textBlocks[1].getText());
71 }
72
73 @Override
74 protected String getGoal() {
75 return "dependency-convergence";
76 }
77 }