1 4 package org.oddjob.monitor.model; 5 6 import java.util.Observable ; 7 import java.util.Observer ; 8 9 import org.oddjob.logging.LogEvent; 10 import org.oddjob.logging.LogLevel; 11 12 import junit.framework.TestCase; 13 14 17 public class LogModelTest extends TestCase implements LogEventProcessor { 18 19 String message; 20 21 public void testMessage() { 22 class MyOb implements Observer { 23 public void update(Observable o, Object arg) { 24 ((LogAction) arg).accept(LogModelTest.this); 25 } 26 } 27 MyOb ob = new MyOb(); 28 29 LogModel test = new LogModel(); 30 test.addObserver(ob); 31 test.logEvent(new LogEvent("foo", 2, LogLevel.DEBUG, "Hello")); 32 assertEquals("Hello", message); 33 } 34 35 38 public void onClear() { 39 41 } 42 45 public void onEvent(String text, LogLevel level) { 46 message = text; 47 } 48 49 52 public void onUnavailable() { 53 55 } 56 } 57 58 | Popular Tags |