AjBuildConfig config = parser.genBuildConfig(new String[] {
"-sourceroots", SRCROOT_1 + File.pathSeparator + SRCROOT_2 },
messageWriter);
-
- assertEquals(new File(SRCROOT_1).getAbsolutePath(), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
+
+ assertEquals(getCanonicalPath(new File(SRCROOT_1)), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
Collection expectedFiles = Arrays.asList(new File[] {
new File(SRCROOT_1+File.separator+"A.java").getAbsoluteFile(),
TestUtil.assertSetEquals(expectedFiles, config.getFiles());
}
+ /**
+ * @param file
+ * @return String
+ */
+ private String getCanonicalPath(File file) {
+ String ret = "";
+ try {
+ ret = file.getCanonicalPath();
+ } catch (IOException ioEx) {
+ fail("Unable to canonicalize " + file + " : " + ioEx);
+ }
+ return ret;
+ }
+
public void testSourceRootDir() throws InvalidInputException {
final String SRCROOT = "testdata/ajc";
AjBuildConfig config = parser.genBuildConfig(new String[] {
"-sourceroots", SRCROOT },
messageWriter);
- assertEquals(new File(SRCROOT).getAbsolutePath(), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
+ assertEquals(getCanonicalPath(new File(SRCROOT)), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
Collection expectedFiles = Arrays.asList(new File[] {
new File(SRCROOT+File.separator+"A.java").getAbsoluteFile(),
"-sourceroots", SRCROOT, "testdata/src1/A.java"},
messageWriter);
- assertEquals(new File(SRCROOT).getAbsolutePath(), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
+ assertEquals(getCanonicalPath(new File(SRCROOT)), ((File)config.getSourceRoots().get(0)).getAbsolutePath());
Collection expectedFiles = Arrays.asList(new File[] {
new File(SRCROOT+File.separator+"Hello.java").getAbsoluteFile(),
assertTrue(
"will generate: " + config.getAjOptions().get(AjCompilerOptions.OPTION_OutJAR),
config.getAjOptions().get(AjCompilerOptions.OPTION_OutJAR).equals(CompilerOptions.GENERATE));
- assertTrue(
- "testclasses jar: " + config.getOutputJar().getName(),
- config.getOutputJar().getAbsolutePath().equals(new File(OUT_JAR).getAbsolutePath()));
+ assertEquals(
+ getCanonicalPath(new File(OUT_JAR)),config.getOutputJar().getAbsolutePath());
File nonExistingJar = new File("testdata/mumbleDoesNotExist.jar");
config = parser.genBuildConfig(new String[] {
"-outjar", nonExistingJar.getAbsolutePath() },
messageWriter);
- assertTrue(
- "testclasses jar: " + config.getOutputJar().getName(),
- config.getOutputJar().getAbsolutePath().equals(nonExistingJar.getAbsolutePath()));
+ assertEquals(
+ getCanonicalPath(nonExistingJar),
+ config.getOutputJar().getAbsolutePath());
nonExistingJar.delete();
}
String badLintFile = "lint.props";
AjBuildConfig config = parser.genBuildConfig(new String[] {"-Xlintfile", lintFile}, messageWriter);
assertTrue(new File(lintFile).exists());
- assertTrue(config.getLintSpecFile().getAbsolutePath(), config.getLintSpecFile().getAbsolutePath().equals(new File(lintFile).getAbsolutePath()));
+ assertEquals(getCanonicalPath(new File(lintFile)),config.getLintSpecFile().getAbsolutePath());
}
public void testOptions() throws InvalidInputException {