From f18fcd2b122b3dbeaa33ce44c99f72f829b1b18f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Tue, 10 Nov 2015 19:28:47 +0100 Subject: [PATCH] =?UTF-8?q?ExtendsVecorStringTest=20teilweise=20in=20ASTBy?= =?UTF-8?q?tecodeTest=20=C3=BCberf=C3=BChrt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/bytecode/types/ExtendsVectorString.jav | 5 -- .../types/ExtendsVectorStringTest.java | 70 +++++++++++-------- test/bytecode/types/ExtendsVectorTest.java | 4 +- 3 files changed, 42 insertions(+), 37 deletions(-) delete mode 100644 test/bytecode/types/ExtendsVectorString.jav diff --git a/test/bytecode/types/ExtendsVectorString.jav b/test/bytecode/types/ExtendsVectorString.jav deleted file mode 100644 index 7829ecd0..00000000 --- a/test/bytecode/types/ExtendsVectorString.jav +++ /dev/null @@ -1,5 +0,0 @@ -import java.util.Vector; - -class ExtendsVectorString extends Vector{ - -} \ No newline at end of file diff --git a/test/bytecode/types/ExtendsVectorStringTest.java b/test/bytecode/types/ExtendsVectorStringTest.java index 5e4e35aa..08549aae 100644 --- a/test/bytecode/types/ExtendsVectorStringTest.java +++ b/test/bytecode/types/ExtendsVectorStringTest.java @@ -2,46 +2,56 @@ package bytecode.types; import static org.junit.Assert.*; -import java.io.File; -import java.io.IOException; import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.util.Vector; - -import junit.framework.TestCase; +import org.junit.BeforeClass; import org.junit.Test; -import bytecode.SourceFileBytecodeTest; -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 bytecode.ASTBytecodeTest; +import de.dhbwstuttgart.syntaxtree.factory.ASTFactory; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.typeinference.Menge; -import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; -import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class ExtendsVectorStringTest extends SourceFileBytecodeTest{ - @Override - protected void init() { - testName = "ExtendsVectorString"; - rootDirectory = System.getProperty("user.dir")+"/test/bytecode/types/"; + +public class ExtendsVectorStringTest extends ASTBytecodeTest{ + public static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/types/"; + + protected static String testName = "ExtendsVectorString"; + + @BeforeClass + public static void init(){ + /* + import java.util.Vector; + + class ExtendsVector extends Vector{ + + } + */ + Menge parameter = new Menge<>(); + parameter.add(new RefType("java.lang.String", sourceFile, 0)); + + de.dhbwstuttgart.syntaxtree.Class classToTest = ASTFactory.createClass(testName, new RefType("java.util.Vector", parameter, sourceFile, 0), null, null, sourceFile); + sourceFile.addElement(classToTest); } @Test - public void testConstruct() throws Exception{ - ClassLoader classLoader = getClassLoader(); + public void testSupertype(){ + try{ + ClassLoader classLoader = getClassLoader(); - Class cls = classLoader.loadClass(testName); - - Object obj = cls.newInstance(); - - Constructor method = cls.getConstructor(new Class[]{}); - method.newInstance(); - assertTrue(true); + Class cls = classLoader.loadClass(testName); + + assertEquals("java.util.Vector", cls.getSuperclass().getName()); + }catch(Exception e){ + e.printStackTrace(); + fail(); + } + } + + @Test + public void testParameter(){ + throw new RuntimeException("Not implemented yet!"); } } diff --git a/test/bytecode/types/ExtendsVectorTest.java b/test/bytecode/types/ExtendsVectorTest.java index 0a0725de..52cc9914 100644 --- a/test/bytecode/types/ExtendsVectorTest.java +++ b/test/bytecode/types/ExtendsVectorTest.java @@ -13,9 +13,9 @@ import de.dhbwstuttgart.syntaxtree.type.RefType; public class ExtendsVectorTest extends ASTBytecodeTest{ -public static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/types/"; + public static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/types/"; - protected static String testName = "ExtendsVectorTest2"; + protected static String testName = "ExtendsVectorTest"; @BeforeClass public static void init(){