1 package org.apache.maven.plugin.surefire.util;
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.apache.maven.surefire.testset.TestListResolver;
24 import org.apache.maven.surefire.util.ScanResult;
25
26 import java.io.File;
27 import java.util.*;
28
29
30
31
32 public class DirectoryScannerTest
33 extends TestCase
34 {
35 public void testLocateTestClasses()
36 throws Exception
37 {
38
39 File baseDir = new File( new File( "target/test-classes" ).getCanonicalPath() );
40 List<String> include = new ArrayList<String>();
41 include.add( "**/*ZT*A.java" );
42 List<String> exclude = new ArrayList<String>();
43
44 DirectoryScanner surefireDirectoryScanner =
45 new DirectoryScanner( baseDir, new TestListResolver( include, exclude ), new TestListResolver( "" ) );
46
47 ScanResult classNames = surefireDirectoryScanner.scan();
48 assertNotNull( classNames );
49 System.out.println( "classNames " + Collections.singletonList(classNames));
50 assertEquals( 3, classNames.size() );
51
52 Map<String, String> props = new HashMap<String, String>();
53 classNames.writeTo( props );
54 assertEquals( 3, props.size() );
55 }
56 }