Methods Summary |
---|
protected void | doTest(java.lang.String target, java.lang.String expectedStart, java.lang.String expectedEnd)Executes a target and checks the beginning and the ending of a file.
The filename depends on the target name: target name testHelloWorld
will search for a file result/concat.HelloWorld.test.
executeTarget(target);
String resultContent = read("result/concat." + target.substring(4) + ".test");
assertTrue("First 5 lines differs.", resultContent.startsWith(expectedStart));
assertTrue("Last 5 lines differs.", resultContent.endsWith(expectedEnd));
|
protected java.lang.String | read(java.lang.String filename)Wrapper for FileUtils.readFully().
Additionally it resolves the filename according the the projects basedir
and closes the used reader.
String content = null;
try {
File file = FILE_UTILS.resolveFile(getProject().getBaseDir(), filename);
java.io.FileReader rdr = new java.io.FileReader(file);
content = FileUtils.readFully(rdr);
rdr.close();
rdr = null;
} catch (Exception e) {
e.printStackTrace();
}
return content;
|
public void | setUp()
configureProject("src/etc/testcases/filters/concat.xml");
|
public void | tearDown()
executeTarget("cleanup");
|
public void | testConcatFilter()
doTest("testConcatFilter", FILE_PREPEND, FILE_APPEND);
|
public void | testConcatFilterAfter()
doTest("testConcatFilterAppend", FILE_PREPEND, FILE_APPEND_WITH);
|
public void | testConcatFilterBefore()
doTest("testConcatFilterPrepend", FILE_PREPEND_WITH, FILE_APPEND);
|
public void | testConcatFilterBeforeAfter()
doTest("testConcatFilterPrependAppend", FILE_PREPEND_WITH, FILE_APPEND_WITH);
|
public void | testFilterReaderAfter()
doTest("testFilterReaderAppend", FILE_PREPEND, FILE_APPEND_WITH);
|
public void | testFilterReaderBefore()
doTest("testFilterReaderPrepend", FILE_PREPEND_WITH, FILE_APPEND);
|
public void | testFilterReaderBeforeAfter()
doTest("testFilterReaderPrependAppend", FILE_PREPEND_WITH, FILE_APPEND_WITH);
|
public void | testFilterReaderNoArgs()
executeTarget("testFilterReaderNoArgs");
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"input/concatfilter.test");
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(), "result/concat.FilterReaderNoArgs.test");
assertTrue("testFilterReaderNoArgs: Result not like expected", FILE_UTILS.contentEquals(expected, result));
|