1 package org.apache.maven.plugin.checkstyle;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import junit.framework.TestCase;
23 import org.codehaus.plexus.PlexusTestCase;
24
25 import java.io.File;
26
27
28
29
30 public class ReportResourceTest
31 extends TestCase
32 {
33 private File outputDir = new File( PlexusTestCase.getBasedir(), "target/unit-test/ReportResource" );
34
35 public void testConstructor()
36 {
37 ReportResource reportResource = new ReportResource( "reportbase", outputDir );
38 assertEquals( "Test resourcePathBase", "reportbase", reportResource.getResourcePathBase() );
39 assertEquals( "Test outputDirectory", outputDir, reportResource.getOutputDirectory() );
40 }
41
42 public void testSetters()
43 {
44 ReportResource reportResource = new ReportResource( null, null );
45 reportResource.setResourcePathBase( "reportbase" );
46 reportResource.setOutputDirectory( outputDir );
47
48 assertEquals( "Test resourcePathBase", "reportbase", reportResource.getResourcePathBase() );
49 assertEquals( "Test outputDirectory", outputDir, reportResource.getOutputDirectory() );
50 }
51
52 public void testCopy()
53 throws Exception
54 {
55 ReportResource reportResource = new ReportResource( "META-INF/plexus", outputDir );
56 reportResource.copy( "components.xml" );
57
58 File copiedFile = new File( outputDir, "components.xml" );
59 assertTrue( "Test copied file exists", copiedFile.exists() );
60 }
61 }