MCTLogger { static void initializeAppender(FileAppender fAppender) { if (fAppender == null) { return; } String newFilename = System.getProperty(MCT_LOG_FILE); if (! StringUtil.isEmpty(newFilename)) { fAppender.setFile(newFilename); fAppender.activateOptions(); } } private  MCTLogger(Logger logger); static MCTLogger getLogger(java.lang.Class<?> c); static MCTLogger getLogger(String loggerName); void info(Object message); void info(String message, Object...params); void warn(Object message); void error(Object message); void error(Object message, Throwable t); void error(Throwable t, String message, Object...params); void debug(Object message); void debug(Object message, Throwable t); void warn(Object message, Throwable t); void warn(String message, Object...params); void debug(String message, Object...params); void fatal(Object message); void fatal(Object message, Throwable t);  }
@Test public void testFileAppenderNominal() { FileAppender fa = new FileAppender(); fa.setFile("origFilename"); System.setProperty(MCTLogger.MCT_LOG_FILE, "newFilename"); MCTLogger.initializeAppender(fa); Assert.assertTrue(! fa.getFile().equals("origFilename")); }
@Test public void testFileAppenderEmptyProperty() { FileAppender fa = new FileAppender(); fa.setFile("origFilename"); System.setProperty(MCTLogger.MCT_LOG_FILE, ""); MCTLogger.initializeAppender(fa); Assert.assertTrue( fa.getFile().equals("origFilename")); }
@Test public void testFileAppenderUnsetProperty() { FileAppender fa = new FileAppender(); fa.setFile("origFilename"); MCTLogger.initializeAppender(fa); Assert.assertTrue( fa.getFile().equals("origFilename")); }
@Test public void testFileAppenderError() { System.setProperty(MCTLogger.MCT_LOG_FILE, "newFilename"); MCTLogger.initializeAppender(null); }