1 37 package net.sourceforge.cruisecontrol.jmx; 38 39 import org.apache.log4j.Level; 40 import org.apache.log4j.Logger; 41 42 import junit.framework.TestCase; 43 44 47 public class LoggerControllerTest extends TestCase { 48 49 private static final Logger LOG = Logger.getLogger(LoggerControllerTest.class); 50 private LoggerControllerMBean controller; 51 private Level originalLevel; 52 53 protected void setUp() throws Exception { 54 controller = new LoggerController(LOG); 55 originalLevel = LOG.getLevel(); 56 LOG.setLevel(Logger.getRootLogger().getLevel()); 58 } 59 60 protected void tearDown() throws Exception { 61 LOG.setLevel(originalLevel); 62 } 63 64 public void testGetLoggingLevel() { 65 assertEquals(LOG.getLevel().toString(), controller.getLoggingLevel()); 66 } 67 68 public void testSetLoggingLevel() { 69 controller.setLoggingLevel(Level.OFF.toString()); 70 assertEquals(LOG.getLevel(), Level.OFF); 71 } 72 73 public void testGetName() { 74 assertEquals(getClass().getName(), controller.getName()); 75 } 76 77 } 78 | Popular Tags |