Ejemplo n.º 1
0
 @Test
 public void testMarkLog_EnsureLogLevel() {
   for (LoggerLevel level : EnumSet.complementOf(EnumSet.of(LoggerLevel.DEFAULT))) {
     reset(logManager);
     when(logManager.getLoggerEffectiveLevel(LOG_NAME)).thenReturn(level);
     logMarker.markLog("test");
     try {
       if (EnumSet.of(LoggerLevel.OFF, LoggerLevel.ERROR, LoggerLevel.WARN).contains(level)) {
         verify(logManager).setLoggerLevel(LOG_NAME, LoggerLevel.INFO);
       } else {
         verify(logManager, never()).setLoggerLevel(anyObject(), anyObject());
       }
     } catch (AssertionError e) {
       throw new AssertionError("Mishandled log level " + level, e);
     }
   }
 }
Ejemplo n.º 2
0
 @Before
 public void setUp() {
   logMarker = new LogMarkerImpl(logManager, eventManager);
   when(logManager.getLoggerEffectiveLevel(LOG_NAME)).thenReturn(LoggerLevel.INFO);
 }