package bytecode.operators; import static org.junit.Assert.*; import java.io.File; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; import java.util.Vector; import org.junit.Ignore; import org.junit.Test; import bytecode.SourceFileBytecodeTest; public class AddFloatOperatorTest extends SourceFileBytecodeTest{ @Override protected void init() { testName = "AddFloatOperator"; rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; } @Test public void testConstruct() throws Exception{ ClassLoader classLoader = getClassLoader(); Class cls = classLoader.loadClass(testName); Object obj = cls.newInstance(); assertTrue(true); } @Test public void testTwoFloats() throws Exception{ ClassLoader classLoader = getClassLoader(); Class cls = classLoader.loadClass(testName); Object obj = cls.newInstance(); Float x = new Float(1.0); Float y = new Float(2.0); Class[] params = new Class[]{ x.getClass(), y.getClass(), }; Method method = cls.getDeclaredMethod("method", params); Float returnValue = (Float) method.invoke(obj, x, y); assertEquals(new Float(3.0), returnValue); } }