@Test public void testConsoleLoggerErrorEnablement() { final PrintStream oldErrStream = System.err; ByteArrayOutputStream systemErrorStream = new ByteArrayOutputStream(); System.setErr(new PrintStream(systemErrorStream)); final String logMessage = "FooMessage8"; loggingClass.logError(logMessage); Assert.assertTrue(systemErrorStream.toString().contains(logMessage)); systemErrorStream = new ByteArrayOutputStream(); System.setErr(new PrintStream(systemErrorStream)); JUnitLoggerProvider.getConsoleLoggerEnablement().setErrorEnabled(false); loggingClass.logError(logMessage); Assert.assertEquals(0, systemErrorStream.size()); systemErrorStream = new ByteArrayOutputStream(); System.setErr(new PrintStream(systemErrorStream)); JUnitLoggerProvider.getConsoleLoggerEnablement().setErrorEnabled(true); loggingClass.logError(logMessage); Assert.assertTrue(systemErrorStream.toString().contains(logMessage)); System.setErr(oldErrStream); }
public static LoggerEnablement getConsoleLoggerEnablement() { return getInstance().consoleLoggerEnablement.getLoggerEnablementForThread(); }
JUnitLoggerProvider implements ILoggerProvider { public static LoggerEnablement getConsoleLoggerEnablement() { return getInstance().consoleLoggerEnablement.getLoggerEnablementForThread(); } }
JUnitLoggerProvider implements ILoggerProvider { public static LoggerEnablement getConsoleLoggerEnablement() { return getInstance().consoleLoggerEnablement.getLoggerEnablementForThread(); } private  JUnitLoggerProvider(); }
JUnitLoggerProvider implements ILoggerProvider { public static LoggerEnablement getConsoleLoggerEnablement() { return getInstance().consoleLoggerEnablement.getLoggerEnablementForThread(); } private  JUnitLoggerProvider(); @Override JUnitLoggerComposite get(final String name, final String wrapperFQCN); static void reset(); static JUnitLogger getGlobalLogger(); @SuppressWarnings("unchecked") static JUnitLogger getLogger(final String name, final String wrapperFQCN); static JUnitLogger getLogger(final Class<?> clazz); static LoggerEnablement getConsoleLoggerEnablement(); static JUnitLoggerComposite getLoggerComposite(final String name, final String wrapperFQCN); }
JUnitLoggerProvider implements ILoggerProvider { public static LoggerEnablement getConsoleLoggerEnablement() { return getInstance().consoleLoggerEnablement.getLoggerEnablementForThread(); } private  JUnitLoggerProvider(); @Override JUnitLoggerComposite get(final String name, final String wrapperFQCN); static void reset(); static JUnitLogger getGlobalLogger(); @SuppressWarnings("unchecked") static JUnitLogger getLogger(final String name, final String wrapperFQCN); static JUnitLogger getLogger(final Class<?> clazz); static LoggerEnablement getConsoleLoggerEnablement(); static JUnitLoggerComposite getLoggerComposite(final String name, final String wrapperFQCN);  }