1 9 10 package org.netbeans.modules.websvc.design.schema2java; 11 12 import java.io.File ; 13 import java.util.List ; 14 import org.netbeans.junit.NbTestCase; 15 16 20 public class JavaGeneratorTest extends NbTestCase { 21 22 static File workingDirectory; 23 public JavaGeneratorTest(String testName) { 24 super(testName); 25 } 26 27 protected void setUp() throws Exception { 28 clearWorkDir(); 29 workingDirectory = getWorkDir(); 30 } 31 32 protected void tearDown() throws Exception { 33 } 34 35 36 38 public void testGenerateJava () { 39 JavaGenerator generator = new JavaGenerator(); 40 JavaGenerator.XJCResult result = generator.generateJavaArtifacts(getFile("Book.xsd"),"Collection", workingDirectory ,"book"); 41 File bookPackage = new File (workingDirectory.getAbsolutePath()+File.separator+"book"); 42 assertTrue("package not created",bookPackage.exists()); 43 assertNotNull(result.getPrimaryFile()); 44 assertTrue("Primary File "+result.getPrimaryFile()+" not created",result.getPrimaryFile().exists()); 45 List <File > secondaryFiles = result.getSecondaryFiles(); 46 assertNotNull(secondaryFiles); 47 for (File file:secondaryFiles) { 48 assertTrue("SecondaryFile "+file+" not created",file.exists()); 49 } 50 } 51 52 private File getFile(String file) { 53 return new File (getDataDir(),file); 54 } 55 56 } 57 | Popular Tags |