1. Test class
public void MyTestCase extends ExceptionTestCase {
public void testXYZ throws Exception {
MyClass myObj = new MyClass();
myobj.doXYZ(); //throws MyException
}
}
2. Test suite
public void MyTestSuite extends TestSuite {
public static Test suite() {
TestSuite suite = new TestSuite("description");
suite.addTest(new MyTest("testXYZ", MyException.class));
return suite;
}
}
I've never ever seen such a stupid thing. Maybe that is the reason for ExceptionTestCase currently not being existent in JUnit 4's CVS version.
Also see the JUnit book for further information.
No comments:
Post a Comment