1 32 33 package com.jeantessier.classreader; 34 35 import java.io.*; 36 37 import junit.framework.*; 38 39 import org.apache.log4j.*; 40 41 public class TestTransientClassfileLoader extends TestCase { 42 public static final String TEST_CLASS = "test"; 43 public static final String TEST_FILENAME = "classes" + File.separator + "test.class"; 44 45 private TransientClassfileLoader loader; 46 47 protected void setUp() throws Exception { 48 Logger.getLogger(getClass()).info("Starting test: " + getName()); 49 50 loader = new TransientClassfileLoader(); 51 } 52 53 protected void tearDown() throws Exception { 54 Logger.getLogger(getClass()).info("End of " + getName()); 55 } 56 57 public void testCreate() { 58 assertEquals("Different number of class names", 59 0, 60 loader.getAllClassNames().size()); 61 assertNull(TEST_CLASS + " should have been null", 62 loader.getClassfile(TEST_CLASS)); 63 } 64 65 public void testStart() throws IOException { 66 assertEquals("Different number of class names", 67 0, 68 loader.getAllClassNames().size()); 69 assertNull(TEST_CLASS + " should have been null", 70 loader.getClassfile(TEST_CLASS)); 71 72 loader.load(new DataInputStream(new FileInputStream(TEST_FILENAME))); 73 74 assertEquals("Different number of class names", 75 0, 76 loader.getAllClassNames().size()); 77 assertNull(TEST_CLASS + " should have remained null", 78 loader.getClassfile(TEST_CLASS)); 79 } 80 } 81 | Popular Tags |