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