package packages; import com.google.common.collect.Lists; import de.dhbwstuttgart.core.JavaTXCompiler; import junit.framework.TestCase; import org.junit.Before; import org.junit.Test; import java.io.File; import java.io.IOException; import java.net.URL; public class mathStrucMatrixOPTest extends TestCase { public static final String rootDirectory = System.getProperty("user.dir")+"/resources/javFiles/packageTest/de/test/"; public mathStrucMatrixOPTest() throws ClassNotFoundException, IOException { /* Generate ToImport class in rootDirectory and in output-Directory */ /* PL 2020-01-07 kann z.Zt. nicht erzeugt werden (siehe Bug 170, http://bugzilla.ba-horb.de/show_bug.cgi?id=170) JavaTXCompiler compiler = new JavaTXCompiler(new File(rootDirectory+"mathStruc.jav")); compiler.typeInference(); compiler.generateBytecode(rootDirectory + "output/"); File f = new File(rootDirectory + "output/de/test/mathStruc.class"); assertTrue(f.exists()); */ JavaTXCompiler compiler = new JavaTXCompiler(new File(rootDirectory+"MatrixOP.jav")); compiler.typeInference(); compiler.generateBytecode(rootDirectory + "output/"); File f = new File(rootDirectory + "output/de/test/MatrixOP.class"); assertTrue(f.exists()); } @Test public void testSetPackageNameInBytecodeAndOutputFolder() throws IOException, ClassNotFoundException { JavaTXCompiler compiler = new JavaTXCompiler( Lists.newArrayList(new File(rootDirectory+"mathStrucMatrixOP.jav")), Lists.newArrayList(new File(rootDirectory+"output/"))); compiler.typeInference(); File f = new File(rootDirectory + "output/de/test/mathStrucMatrixOP.class"); if(f.exists() && !f.isDirectory()) { f.delete(); } compiler.generateBytecode(rootDirectory + "output/"); f = new File(rootDirectory + "output/de/test/mathStrucMatrixOP.class"); assertTrue(f.exists()); } }