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
31 public class ReportResourceTest
32 extends TestCase
33 {
34 private File outputDir = new File( PlexusTestCase.getBasedir(), "target/unit-test/ReportResource" );
35
36 public void testConstructor()
37 {
38 ReportResource reportResource = new ReportResource( "reportbase", outputDir );
39 assertEquals( "Test resourcePathBase", "reportbase", reportResource.getResourcePathBase() );
40 assertEquals( "Test outputDirectory", outputDir, reportResource.getOutputDirectory() );
41 }
42
43 public void testSetters()
44 {
45 ReportResource reportResource = new ReportResource( null, null );
46 reportResource.setResourcePathBase( "reportbase" );
47 reportResource.setOutputDirectory( outputDir );
48
49 assertEquals( "Test resourcePathBase", "reportbase", reportResource.getResourcePathBase() );
50 assertEquals( "Test outputDirectory", outputDir, reportResource.getOutputDirectory() );
51 }
52
53 public void testCopy()
54 throws Exception
55 {
56 ReportResource reportResource = new ReportResource( "META-INF/plexus", outputDir );
57 reportResource.copy( "components.xml" );
58
59 File copiedFile = new File( outputDir, "components.xml" );
60 assertTrue( "Test copied file exists", copiedFile.exists() );
61 }
62 }