1 package de.java2html.test; 2 3 import junit.framework.TestCase; 4 5 8 public abstract class BasicTestCase extends TestCase { 9 public static void assertThrowsException(Class expectedExceptionClass, IBlock block) { 10 try { 11 block.execute(); 12 fail("Exception of type " + expectedExceptionClass + " expected."); } 14 catch (Exception exception) { 15 assertTrue("Exception of type " + expectedExceptionClass 17 + " expecrted, but was " + exception.getClass(), expectedExceptionClass.isAssignableFrom(exception.getClass())); 19 } 20 } 21 22 public static void assertInstanceOf(Class expectedClass, Object actualObject) { 23 assertNotNull(actualObject); 24 assertTrue(expectedClass.isAssignableFrom(actualObject.getClass())); 25 } 26 27 public static interface IBlock { 28 public void execute() throws Exception ; 29 } 30 31 } | Popular Tags |