publicclass StreamsTest extends TestRunner { publicstaticvoid main(String... args) throws Exception { new StreamsTest().runTests(m -> new Object[] { Paths.get(m.getName()) });
}
StreamsTest() { super(System.err);
}
ToolBox tb = new ToolBox(); staticfinal String LINESEP = System.getProperty("line.separator");
@Test // errors should be written to stderr publicvoid testError(Path base) throws Exception {
Path src = base.resolve("src");
Path classes = base.resolve("classes");
tb.writeJavaFiles(src, "import java.util.*; class C { # }");
test(asList("-d", classes.toString(), src.resolve("C.java").toString()), null, "illegal character: '#'");
}
@Test // warnings should be written to stderr publicvoid testWarning(Path base) throws Exception {
Path src = base.resolve("src");
Path classes = base.resolve("classes");
tb.writeJavaFiles(src, "import java.util.*; class C { List list = new ArrayList(); }");
test(asList("-d", classes.toString(), "-Xlint", src.resolve("C.java").toString()), null, "warning: [rawtypes]");
}
@Test // notes should be written to stderr publicvoid testNote(Path base) throws Exception {
Path src = base.resolve("src");
Path classes = base.resolve("classes");
tb.writeJavaFiles(src, "import java.util.*; class C { List<String> list = (List<String>) new ArrayList(); }");
test(asList("-d", classes.toString(), src.resolve("C.java").toString()), null, "uses unchecked or unsafe operations.");
}
@Test // help output should be written to stdout publicvoid testHelp(Path base) throws Exception {
test(asList("-help"), "Usage: javac <options> <source files>", null);
}
@Test // version output should be written to stdout publicvoid testVersion(Path base) throws Exception {
test(asList("-version"), "javac", null);
}
@Test // version output should be written to stdout publicvoid testFullVersion(Path base) throws Exception {
test(asList("-fullversion"), "javac full version", null);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.