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.WebLink;
27 import com.meterware.httpunit.WebRequest;
28 import com.meterware.httpunit.WebResponse;
29
30
31
32
33
34
35 public class IssueManagementReportTest extends AbstractProjectInfoTestCase {
36
37
38
39 private static final WebConversation WEB_CONVERSATION = new WebConversation();
40
41
42
43
44
45
46 public void testReport() throws Exception {
47 generateReport(getGoal(), "issue-management-plugin-config.xml");
48 assertTrue(
49 "Test html generated",
50 getGeneratedReport("issue-management.html").exists());
51
52 URL reportURL = getGeneratedReport("issue-management.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 =
65 prepareTitle("issue management project info", getString("report.issue-management.title"));
66 assertEquals(expectedTitle, response.getTitle());
67
68
69 WebLink[] weblinks = response.getLinks();
70 assertEquals(4, weblinks.length);
71
72 assertEquals("JIRA", weblinks[1].getText());
73
74 assertEquals("http://localhost/jira", weblinks[2].getText());
75
76
77 TextBlock[] textBlocks = response.getTextBlocks();
78 assertEquals(getString("report.issue-management.overview.title"), textBlocks[1].getText());
79 assertEquals("This project uses JIRA.", textBlocks[2].getText());
80 assertEquals(getString("report.issue-management.name"), textBlocks[3].getText());
81 }
82
83 @Override
84 protected String getGoal() {
85 return "issue-management";
86 }
87 }