01: package de.java2html.test;
02:
03: import junit.framework.TestCase;
04:
05: /**
06: * @author Markus Gebhard
07: */
08: public abstract class BasicTestCase extends TestCase {
09: public static void assertThrowsException(
10: Class expectedExceptionClass, IBlock block) {
11: try {
12: block.execute();
13: fail("Exception of type " + expectedExceptionClass + " expected."); //$NON-NLS-1$//$NON-NLS-2$
14: } catch (Exception exception) {
15: assertTrue("Exception of type " //$NON-NLS-1$
16: + expectedExceptionClass + " expecrted, but was " //$NON-NLS-1$
17: + exception.getClass(), expectedExceptionClass
18: .isAssignableFrom(exception.getClass()));
19: }
20: }
21:
22: public static void assertInstanceOf(Class expectedClass,
23: Object actualObject) {
24: assertNotNull(actualObject);
25: assertTrue(expectedClass.isAssignableFrom(actualObject
26: .getClass()));
27: }
28:
29: public static interface IBlock {
30: public void execute() throws Exception;
31: }
32:
33: }
|