1 package org.picocontainer.monitors; 2 3 import java.io.PrintStream ; 4 import java.lang.reflect.Constructor ; 5 import java.lang.reflect.Method ; 6 7 import junit.framework.TestCase; 8 9 import org.picocontainer.ComponentMonitor; 10 11 16 public class ConsoleComponentMonitorTestCase extends TestCase { 17 private PrintStream out; 18 private ComponentMonitor componentMonitor; 19 private Constructor constructor; 20 private Method method; 21 22 protected void setUp() throws Exception { 23 out = System.out; 24 constructor = getClass().getConstructor((Class [])null); 25 method = getClass().getDeclaredMethod("setUp", (Class [])null); 26 componentMonitor = new ConsoleComponentMonitor(out); 27 } 28 29 public void testShouldTraceInstantiating() { 30 componentMonitor.instantiating(constructor); 31 } 32 33 public void testShouldTraceInstantiated() { 34 componentMonitor.instantiated(constructor, 543); 35 } 36 37 public void testShouldTraceInstantiatedWithInjected() { 38 componentMonitor.instantiated(constructor, new Object (), new Object [0], 543); 39 } 40 41 public void testShouldTraceInstantiationFailed() { 42 componentMonitor.instantiationFailed(constructor, new RuntimeException ("doh")); 43 } 44 45 public void testShouldTraceInvoking() { 46 componentMonitor.invoking(method, this); 47 } 48 49 public void testShouldTraceInvoked() { 50 componentMonitor.invoked(method, this, 543); 51 } 52 53 public void testShouldTraceInvocatiationFailed() { 54 componentMonitor.invocationFailed(method, this, new RuntimeException ("doh")); 55 } 56 57 } 58 | Popular Tags |