Thursday, January 12, 2006

proof that it works


import junit.framework.*;
import java.lang.reflect.*;
import java.util.Arrays;
/*
* DoNothingTest.java
* JUnit based test
*
* Created on January 12, 2006, 10:35 PM
*/

public class DoNothingTest extends TestCase {

public DoNothingTest(String testName) {
super(testName);
}

protected void setUp() throws Exception {
}

protected void tearDown() throws Exception {
}

public static interface BunchaMethods {
void doVoid();
int getInt();
String getString();
Integer getInteger();
Object getObject();
int[] getIntArray();
}

public void testNewInstance() {

BunchaMethods b = (BunchaMethods) DoNothing.newInstance(BunchaMethods.class);

b.doVoid(); // nothing happens!

assertEquals( 0, b.getInt());

assertEquals( null, b.getString());
assertEquals( null, b.getInteger());
assertEquals( null, b.getObject());
assertEquals( null, b.getIntArray());

}

}

Comments: