Methods Summary |
---|
protected java.util.Set | mayExist()List of files which may or may not be generated.
HashSet set = new HashSet();
return set;
|
protected java.lang.String | rootDir()The directory containing the files that should exist.
return "build" + File.separator + "work" + File.separator +
"test" + File.separator + "wsdl" + File.separator +
"extra";
|
protected java.util.Set | shouldExist()List of files which should be generated.
HashSet set = new HashSet();
set.add("Extra.java"); // this is the important one
set.add("MyService.java");
set.add("MyServiceService.java");
set.add("MyServiceServiceLocator.java");
set.add("MyServiceSoapBindingStub.java");
set.add("MyService.wsdl");
set.add("ExtraClassesTestCase.java");
return set;
|
public void | testFileGen()
String rootDir = rootDir();
Set shouldExist = shouldExist();
Set mayExist = mayExist();
// open up the output directory and check what files exist.
File outputDir = new File(rootDir);
String[] files = outputDir.list();
Vector shouldNotExist = new Vector();
for (int i = 0; i < files.length; ++i) {
if (shouldExist.contains(files[i])) {
shouldExist.remove(files[i]);
}
else if (mayExist.contains(files[i])) {
mayExist.remove(files[i]);
}
else {
shouldNotExist.add(files[i]);
}
}
if (shouldExist.size() > 0) {
fail("The following files should exist but do not: " + shouldExist);
}
if (shouldNotExist.size() > 0) {
fail("The following files should NOT exist, but do: " + shouldNotExist);
}
|