mil.dod.th.ose.time.service/test/mil/dod/th/ose/time/service/logging/TestTimeChangeServiceLogger.java
@Test
    public void testLogMessage() throws IOException
    {
        TimeChangeServiceLogger.setupLogger(CUSTOM_LOG_DIR);
        
        TimeChangeServiceLogger.logMessage(Level.INFO, "This is a message");
        
        Logger logger = Logger.getLogger("TimeServiceLogger");
        
        for (Handler handler : logger.getHandlers())
        {
            handler.close();
        }
        
        File file = new File(CUSTOM_LOG_LOCATION);
        BufferedReader reader = new BufferedReader(new FileReader(file));
        StringBuilder builder = new StringBuilder();
        
        String line = null;
        while ((line = reader.readLine()) != null)
        {
            builder.append(line);
        }
        
        reader.close();
        assertThat(builder.toString().contains("This is a message"), is(true));
    }
/**
     * Verify that the message is logged to the correct file.
     */
Verify that the message is logged to the correct file.
Verify that the message is logged to the correct file .
@Test
    public void testLogMessage() throws IOException
    {
        TimeChangeServiceLogger.setupLogger(CUSTOM_LOG_DIR);
        TimeChangeServiceLogger.logMessage(Level.INFO, "This is a message");
        Logger logger = Logger.getLogger("TimeServiceLogger");
        for (Handler handler : logger.getHandlers())
        {
            handler.close();
        }
        File file = new File(CUSTOM_LOG_LOCATION);
        BufferedReader reader = new BufferedReader(new FileReader(file));
        StringBuilder builder = new StringBuilder();
        String line = null;
        while ((line = reader.readLine()) != null)
        {
            builder.append(line);
        }
        reader.close();
        assertThat(builder.toString().contains("This is a message"), is(true));
    }
@ Test public void testLogMessage ( ) throws IOException { TimeChangeServiceLogger . setupLogger ( CUSTOM_LOG_DIR ) ; TimeChangeServiceLogger . logMessage ( Level . INFO , "This is a message" ) ; Logger logger = Logger . getLogger ( "TimeServiceLogger" ) ; for ( Handler handler : logger . getHandlers ( ) ) { handler . close ( ) ; } File file = new File ( CUSTOM_LOG_LOCATION ) ; BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ; StringBuilder builder = new StringBuilder ( ) ; String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { builder . append ( line ) ; } reader . close ( ) ; assertThat ( builder . toString ( ) . contains ( "This is a message" ) , is ( true ) ) ; }
Verify that the message is logged to the correct file.
Verify that the message is logged to the correct file .