36 lines
814 B
Java
36 lines
814 B
Java
package bytecode;
|
|
|
|
import java.io.File;
|
|
import java.io.FileOutputStream;
|
|
import java.io.IOException;
|
|
import java.util.Vector;
|
|
|
|
import junit.framework.TestCase;
|
|
|
|
import org.junit.Test;
|
|
|
|
import de.dhbwstuttgart.bytecode.ClassFile;
|
|
import sun.misc.IOUtils;
|
|
|
|
public class GeneralTest extends TestCase{
|
|
@Test
|
|
public void test(){
|
|
Vector<ClassFile> cfs = null;
|
|
try {
|
|
cfs = BytecodeTester.readFileAndTestCodegen("FieldTest.jav");
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
fail();
|
|
}
|
|
assertTrue("Es darf nur eine ClassFile erstellt werden", cfs.size()==1);
|
|
try {
|
|
FileOutputStream output = new FileOutputStream(new File(BytecodeTester.rootDirectory+"FieldTest.class"));
|
|
output.write(cfs.firstElement().getBytecode());
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
fail();
|
|
}
|
|
}
|
|
|
|
}
|