JavaCompilerCore/test/bytecode/NewStatementTest.java
2015-11-06 18:27:47 +01:00

56 lines
1.6 KiB
Java

package bytecode;
import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import junit.framework.TestCase;
import org.junit.Test;
import plugindevelopment.TypeInsertTester;
import de.dhbwstuttgart.core.MyCompiler;
import de.dhbwstuttgart.core.MyCompilerAPI;
import de.dhbwstuttgart.logger.LoggerConfiguration;
import de.dhbwstuttgart.logger.Section;
import de.dhbwstuttgart.parser.JavaParser.yyException;
import de.dhbwstuttgart.typeinference.ByteCodeResult;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet;
public class NewStatementTest {
public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/";
public final static String testFile = "NewStatement.jav";
public final static String outputFile = "NewStatement.class";
@Test
public void test() {
SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory);
}
@Test
public void testUntypedVectorDeclaredMethods() {
try{
File file = new File(System.getProperty("user.dir")+"/test/bytecode/types/");
URL url = file.toURL();
URL[] urls = new URL[]{url};
ClassLoader classLoader = new URLClassLoader(urls);
Class untypedVectorTest = classLoader.loadClass("UntypedVector");
for(Method method: untypedVectorTest.getDeclaredMethods()){
System.out.println(method.toGenericString());
}
}catch(Exception e){
throw new RuntimeException(e);
}
}
}