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