public static void testAbsentIncludes() throws IOException { Analyzer analyzer = new Analyzer(); analyzer.setBase(IO.getFile("src/test")); Properties p = new Properties(); p.put("-include", "-iamnotthere.txt"); analyzer.setProperties(p); System.err.println(analyzer.getErrors()); assertEquals(0, analyzer.getErrors().size()); }
public static void testInvalidCaseForHeader() throws Exception { Properties p = new Properties(); p.put("Export-package", "org.apache.mina.*"); p.put("Bundle-Classpath", "."); Analyzer analyzer = new Analyzer(); analyzer.setProperties(p); analyzer.getProperties(); System.err.println("Errors " + analyzer.getErrors()); System.err.println("Warnings " + analyzer.getWarnings()); assertEquals(0, analyzer.getErrors().size()); assertEquals(2, analyzer.getWarnings().size()); }
public static void testIncludeWithProperty() throws IOException { File home = new File(System.getProperty("user.home")); File include = new File(home, "includeheadertest.txt"); try { FileOutputStream fw = new FileOutputStream(include); fw.write("IncludeHeaderTest: yes\n\r".getBytes()); fw.write("a: 2\n\r".getBytes()); fw.write("b: ${a}\n\r".getBytes()); fw.close(); Analyzer analyzer = new Analyzer(); analyzer.setBase(IO.getFile("src/test")); Properties p = new Properties(); p.put("a", "1"); p.put("-include", "-iamnotthere.txt, ${user.home}/includeheadertest.txt"); analyzer.setProperties(p); String value = analyzer.getProperty("IncludeHeaderTest"); assertEquals("yes", value); assertEquals("2", analyzer.getProperty("a")); assertEquals("2", analyzer.getProperty("b")); assertEquals(0, analyzer.getErrors().size()); } finally { include.delete(); } }