Methods Summary |
---|
public void | setUp()
configureProject(PROJECT_PATH + "/replaceregexp.xml");
|
public void | tearDown()
executeTarget("cleanup");
|
public void | testDirectoryDateDoesNotChange()
executeTarget("touchDirectory");
File myFile = new File(System.getProperty("root"), PROJECT_PATH + "/" + getProject().getProperty("tmpregexp"));
long timeStampBefore = myFile.lastModified();
executeTarget("testDirectoryDateDoesNotChange");
long timeStampAfter = myFile.lastModified();
assertEquals("directory date should not change",
timeStampBefore, timeStampAfter);
|
public void | testDontAddNewline1()
executeTarget("testDontAddNewline1");
assertTrue("Files match",
FILE_UTILS
.contentEquals(new File(System.getProperty("root"), PROJECT_PATH + "/test.properties"),
new File(System.getProperty("root"), PROJECT_PATH + "/replaceregexp2.result.properties")));
|
public void | testDontAddNewline2()
executeTarget("testDontAddNewline2");
assertTrue("Files match",
FILE_UTILS
.contentEquals(new File(System.getProperty("root"), PROJECT_PATH + "/test.properties"),
new File(System.getProperty("root"), PROJECT_PATH + "/replaceregexp2.result.properties")));
|
public void | testReplace()
Properties original = new Properties();
FileInputStream propsFile = null;
try {
propsFile = new FileInputStream(new File(System.getProperty("root"), PROJECT_PATH + "/replaceregexp.properties"));
original.load(propsFile);
} finally {
if (propsFile != null) {
propsFile.close();
propsFile = null;
}
}
assertEquals("Def", original.get("OldAbc"));
executeTarget("testReplace");
Properties after = new Properties();
try {
propsFile = new FileInputStream(new File(System.getProperty("root"), PROJECT_PATH + "/test.properties"));
after.load(propsFile);
} finally {
if (propsFile != null) {
propsFile.close();
propsFile = null;
}
}
assertNull(after.get("OldAbc"));
assertEquals("AbcDef", after.get("NewProp"));
|