mil.dod.th.ose.logging/test/mil/dod/th/ose/logging/TestLoggingService.java
@Test
    public final void testLogServiceRefAndThrowable()
    {
        // mock
        ServiceReference<?> ref = mock(ServiceReference.class);
        when(ref.getProperty(Constants.SERVICE_ID)).thenReturn(5);
        when(ref.getProperty(Constants.OBJECTCLASS)).thenReturn(new String[] { "test" });
        
        Exception e = new Exception();
        
        // replay
        m_SUT.log(ref, LogService.LOG_DEBUG, e, "hello");
        
        // verify
        verify(m_LogService).log(ref, LogService.LOG_DEBUG, "hello", e);
        
        // replay
        m_SUT.log(ref, LogService.LOG_DEBUG, e, "some %s %d u", "message", 4);
        
        // verify
        verify(m_LogService).log(ref, LogService.LOG_DEBUG, "some message 4 u", e);
    }
/**
     * Verify logging a service reference and throwable will both be sent to the OSGi log service.
     */
Verify logging a service reference and throwable will both be sent to the OSGi log service.
Verify logging a service reference and throwable will both be sent to the OSGi log service .
@Test
    public final void testLogServiceRefAndThrowable()
    {
        ServiceReference<?> ref = mock(ServiceReference.class);
        when(ref.getProperty(Constants.SERVICE_ID)).thenReturn(5);
        when(ref.getProperty(Constants.OBJECTCLASS)).thenReturn(new String[] { "test" });
        Exception e = new Exception();
        m_SUT.log(ref, LogService.LOG_DEBUG, e, "hello");
        verify(m_LogService).log(ref, LogService.LOG_DEBUG, "hello", e);
        m_SUT.log(ref, LogService.LOG_DEBUG, e, "some %s %d u", "message", 4);
        verify(m_LogService).log(ref, LogService.LOG_DEBUG, "some message 4 u", e);
    }
@ Test public final void testLogServiceRefAndThrowable ( ) { ServiceReference < ? > ref = mock ( ServiceReference . class ) ; when ( ref . getProperty ( Constants . SERVICE_ID ) ) . thenReturn ( 5 ) ; when ( ref . getProperty ( Constants . OBJECTCLASS ) ) . thenReturn ( new String [ ] { "test" } ) ; Exception e = new Exception ( ) ; m_SUT . log ( ref , LogService . LOG_DEBUG , e , "hello" ) ; verify ( m_LogService ) . log ( ref , LogService . LOG_DEBUG , "hello" , e ) ; m_SUT . log ( ref , LogService . LOG_DEBUG , e , "some %s %d u" , "message" , 4 ) ; verify ( m_LogService ) . log ( ref , LogService . LOG_DEBUG , "some message 4 u" , e ) ; }
Verify logging a service reference and throwable will both be sent to the OSGi log service.
Verify logging a service reference and throwable will both be sent to the OSGi log service .
// mock // replay // verify // replay // verify