1 package org.apache.maven.jxr;
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 java.io.File;
25 import java.util.Collections;
26
27
28
29
30
31
32
33 public class IncludeExcludeTest extends TestCase
34 {
35 private JXR jxr;
36
37 protected void setUp()
38 throws Exception
39 {
40 super.setUp();
41 jxr = new JXR();
42 jxr.setDest( System.getProperty( "basedir" ) + "/target" );
43 jxr.setInputEncoding( "ISO-8859-1" );
44 jxr.setOutputEncoding( "ISO-8859-1" );
45 jxr.setJavadocLinkDir( "" );
46 jxr.setLog( new DummyLog() );
47 }
48
49 public void testIncludeExclude()
50 throws Exception
51 {
52 String[] excludes = {"**/exclude/ExcludedClass.java"};
53 jxr.setExcludes( excludes );
54 String[] includes = {"**/exclude/*.java", "**/include/IncludedClass.java"};
55 jxr.setIncludes( includes );
56 jxr.xref( Collections.singletonList( System.getProperty( "basedir" ) + "/src/test/resources" ), "templates",
57 "title", "title", "copyright" );
58 File excludedFile = new File( System.getProperty( "basedir" ) + "/target/exclude/ExcludedClass.html" );
59 assertFalse( excludedFile.exists() );
60 File includedFile = new File( System.getProperty( "basedir" ) + "/target/include/IncludedClass.html" );
61 assertTrue( includedFile.exists() );
62 File notIncludedFile = new File( System.getProperty( "basedir" ) + "/target/include/NotIncludedClass.html" );
63 assertFalse( notIncludedFile.exists() );
64 }
65 }