File base = new File("base");
File file1 = new File("file1");
File file2 = new File("file2");
// setup the selector
ModifiedSelector sel = new ModifiedSelector();
sel.setProject(project);
sel.setUpdate(true);
sel.setDelayUpdate(true);
// sorry - otherwise we will get a ClassCastException because the MockCache
// is loaded by two different classloader ...
sel.setClassLoader(this.getClass().getClassLoader());
sel.addClasspath(testclasses);
sel.setAlgorithmClass("org.apache.tools.ant.types.selectors.MockAlgorithm");
sel.setCacheClass("org.apache.tools.ant.types.selectors.MockCache");
sel.configure();
// get the cache, so we can check our things
MockCache cache = (MockCache)sel.getCache();
// the test
assertFalse("Cache must not be saved before 1st selection.", cache.saved);
sel.isSelected(base, "file1", file1);
assertFalse("Cache must not be saved after 1st selection.", cache.saved);
sel.isSelected(base, "file2", file2);
assertFalse("Cache must not be saved after 2nd selection.", cache.saved);
switch (kind) {
case 1 : project.fireTaskFinished(); break;
case 2 : project.fireTargetFinished(); break;
case 3 : project.fireBuildFinished(); break;