mil.dod.th.ose.logging/test/mil/dod/th/ose/logging/TestLogWriter.java
@Test
    public void testActivate()
    {
        BundleContext context = mock(BundleContext.class);
        Map<String, Object> props = new HashMap<String, Object>(getComponentProperties());
        when(context.getProperty(LogWriter.LOG_LEVEL_PROPERTY)).thenReturn(null);
        m_SUT.activate(context, props);
        // This is to mimic the log file created during activation.
        setUpFileNaming();

        // Verify that null properties don't cause an exception
        when(context.getProperty(LogWriter.LOG_DIR_PROPERTY)).thenReturn(null);
        when(context.getProperty(LogWriter.LOG_STDOUT_PROPERTY)).thenReturn(null);

        m_SUT.deactivate();
    }
/**
     * Test that activation retrieves needed properties, and opens a log file.
     */
Test that activation retrieves needed properties, and opens a log file.
Test that activation retrieves needed properties and opens a log file .
@Test
    public void testActivate()
    {
        BundleContext context = mock(BundleContext.class);
        Map<String, Object> props = new HashMap<String, Object>(getComponentProperties());
        when(context.getProperty(LogWriter.LOG_LEVEL_PROPERTY)).thenReturn(null);
        m_SUT.activate(context, props);
        setUpFileNaming();
        when(context.getProperty(LogWriter.LOG_DIR_PROPERTY)).thenReturn(null);
        when(context.getProperty(LogWriter.LOG_STDOUT_PROPERTY)).thenReturn(null);
        m_SUT.deactivate();
    }
@ Test public void testActivate ( ) { BundleContext context = mock ( BundleContext . class ) ; Map < String , Object > props = new HashMap < String , Object > ( getComponentProperties ( ) ) ; when ( context . getProperty ( LogWriter . LOG_LEVEL_PROPERTY ) ) . thenReturn ( null ) ; m_SUT . activate ( context , props ) ; setUpFileNaming ( ) ; when ( context . getProperty ( LogWriter . LOG_DIR_PROPERTY ) ) . thenReturn ( null ) ; when ( context . getProperty ( LogWriter . LOG_STDOUT_PROPERTY ) ) . thenReturn ( null ) ; m_SUT . deactivate ( ) ; }
Test that activation retrieves needed properties, and opens a log file.
Test that activation retrieves needed properties and opens a log file .
// This is to mimic the log file created during activation. // Verify that null properties don't cause an exception