JavaTXCompilerInJavaTX/test/bytecode/OverloadingTest.java
Enrico Schrödter 0a17be3c4f Abstrakter Test für BytecodeTests
TypedVectorTest angelegt: funktoniert schon
OverloadingTest angelegt: Nächstes Ziel
2015-10-15 19:12:38 +02:00

57 lines
1.1 KiB
Java

package bytecode;
import static org.junit.Assert.*;
import java.lang.reflect.Method;
import java.util.Vector;
import org.junit.Test;
public class OverloadingTest extends BytecodeTest{
@Override
protected void init() {
testName = "Overloading";
}
@Test
public void testString() {
try{
Class cls = getClassToTest();
Object obj = cls.newInstance();
Vector<String> stringVector = new Vector<String>();
Class[] params = new Class[1];
params[0] = stringVector.getClass();
Method method = cls.getDeclaredMethod("method", params);
method.invoke(obj, stringVector);
assertTrue(true);
}catch(Exception e){
e.printStackTrace();
fail();
}
}
@Test
public void testInteger() {
try{
Class cls = getClassToTest();
Object obj = cls.newInstance();
Vector<Integer> stringVector = new Vector<Integer>();
Class[] params = new Class[1];
params[0] = stringVector.getClass();
Method method = cls.getDeclaredMethod("method", params);
method.invoke(obj, stringVector);
assertTrue(true);
}catch(Exception e){
e.printStackTrace();
fail();
}
}
}