forked from functionaljava/functionaljava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
51 lines (47 loc) · 1.49 KB
/
Main.java
File metadata and controls
51 lines (47 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package fj.test.reflect;
import fj.Effect;
import fj.P2;
import static fj.data.Array.array;
import fj.test.CheckResult;
import static fj.test.CheckResult.summary;
import static fj.test.reflect.Check.check;
import static java.lang.Class.forName;
import static java.lang.System.exit;
import static java.lang.System.out;
/**
* Checks the properties of a class using a standard random generator, standard check parameters and
* the given categories. The class name and categories are passed as command line arguments.
*
* @version %build.number%
*/
public final class Main {
private Main() {
throw new UnsupportedOperationException();
}
/**
* Check the given class and categories. At least one command line argument (the class name) must be
* passed or an error message results.
*
* @param args The class name as the first argument, then zero or more categories.
*/
public static void main(final String... args) {
if(args.length == 0) {
System.err.println("<class> [category]*");
//noinspection CallToSystemExit
exit(441);
} else {
try {
check(forName(args[0]), array(args).toList().tail()).foreach(new Effect<P2<String, CheckResult>>() {
public void e(final P2<String, CheckResult> r) {
summary.print(r._2());
out.println(" (" + r._1() + ')');
}
});
} catch(ClassNotFoundException e) {
System.err.println(e);
//noinspection CallToSystemExit
exit(144);
}
}
}
}