Methods Summary |
---|
private java.util.Hashtable | getResultFiles()Read the result fileset into a Hashtable
FileSet resultFileSet = (FileSet) project.getReference(RESULT_FILESET);
DirectoryScanner scanner = resultFileSet.getDirectoryScanner(project);
String[] scannedFiles = scanner.getIncludedFiles();
Hashtable files = new Hashtable();
for (int i = 0; i < scannedFiles.length; ++i) {
files.put(scannedFiles[i], scannedFiles[i]);
}
return files;
|
public void | setUp()
configureProject(TEST_BUILD_FILE);
|
public void | tearDown()
executeTarget("clean");
|
public void | testCache()Test the operation of the cache
executeTarget("testcache");
|
public void | testClosure()Test dependency traversal (closure)
executeTarget("testclosure");
Hashtable files = getResultFiles();
assertTrue("Depend did not leave correct number of files",
files.size() <= 2);
assertTrue("Result did not contain D.class",
files.containsKey("D.class"));
|
public void | testDirect()Test direct dependency removal
executeTarget("testdirect");
Hashtable files = getResultFiles();
assertEquals("Depend did not leave correct number of files", 3,
files.size());
assertTrue("Result did not contain A.class",
files.containsKey("A.class"));
assertTrue("Result did not contain D.class",
files.containsKey("D.class"));
|
public void | testEmptySource()Test that an exception is thrown when the source attribute is empty
expectBuildExceptionContaining("testemptysource",
"No source specified", "srcdir attribute must be non-empty");
|
public void | testInner()Test that inner class dependencies trigger deletion of the outer class
executeTarget("testinner");
assertEquals("Depend did not leave correct number of files", 0,
getResultFiles().size());
|
public void | testInnerClosure()Test mutual dependency between inner and outer do not cause both to be
deleted
executeTarget("testinnerclosure");
assertEquals("Depend did not leave correct number of files", 4,
getResultFiles().size());
|
public void | testInnerInner()Test that multi-leve inner class dependencies trigger deletion of
the outer class
executeTarget("testinnerinner");
assertEquals("Depend did not leave correct number of files", 0,
getResultFiles().size());
|
public void | testNoSource()Test that an exception is thrown when there is no source
expectBuildExceptionContaining("testnosource",
"No source specified", "srcdir attribute must be set");
|
public void | testNonPublic()Test the detection and warning of non public classes
executeTarget("testnonpublic");
String log = getLog();
assertTrue("Expected warning about APrivate",
log.indexOf("The class APrivate in file") != -1);
assertTrue("but has not been deleted because its source file "
+ "could not be determined",
log.indexOf("The class APrivate in file") != -1);
|