1
2 package eu.simuline.testhelpers;
3
4 import eu.simuline.util.Finder;
5
6 import java.io.File;
7
8
9
10
11
12
13
14 public abstract class JUnitSingleTester {
15
16
17
18
19
20
21
22
23
24
25
26
27 @SuppressWarnings("checkstyle:nowhitespacebefore")
28 public static void main(String[] args) {
29 if (args.length != 2) {
30 throw new IllegalArgumentException
31 ("Expected exactly two araguments but found " +
32 args.length + ". ");
33 }
34
35 File baseDir = new File(args[0] + args[1]);
36 String dirName = baseDir.getAbsolutePath();
37 Finder finder = Finder.path(baseDir)
38
39 .not(Finder.nameFilter(".*arithmetics.*"))
40 .not(Finder.nameFilter(".*graphDV.*"))
41
42 .name(".*Test\\.class")
43
44 ;
45
46 File clsFile;
47 String clsName;
48
49 while (finder.hasNext()) {
50 clsFile = finder.next();
51 clsName = clsFile.getAbsolutePath();
52 System.out.println("clsName" + clsName);
53
54 assert clsName.startsWith(dirName);
55 clsName = clsName.substring(args[0].length());
56 clsName = clsName.substring(0,
57 clsName.length() - ".class".length());
58 System.out.println("clsName" + clsName);
59
60 clsName = clsName.replace(System.getProperty("file.separator")
61 .charAt(0), '.');
62 System.out.println("clsName: " + clsName);
63 Actions.runTestClass(clsName);
64 }
65
66 }
67 }
68