edu.udayton.udri.asset.novatel/test/edu/udayton/udri/asset/novatel/impl/timechanger/TestTimeChangeImpl.java
@Test
    public void testDisconnect() throws IOException, InterruptedException
    {
        m_SUT.connectTimeService(m_StatusHandler, PORT);
        
        verify(m_ClientSocketFactory, timeout(1000))
            .createClientSocket(Mockito.anyString(), eq(PORT));
        m_SUT.disconnectTimeService();
        
        verify(m_ClientSocket).close();
        
        ArgumentCaptor<ComponentStatus> statusCaptor = ArgumentCaptor.forClass(ComponentStatus.class);
        verify(m_StatusHandler, timeout(1000).atLeast(1)).handleStatusUpdate(statusCaptor.capture());
        
        ComponentStatus status = statusCaptor.getValue();
        
        assertThat(status.getComponent().getType(), is(ComponentTypeEnum.SOFTWARE_UNIT));
        assertThat(status.getComponent().getDescription(), is("Time Service"));
        assertThat(status.getStatus().getSummary(), is(SummaryStatusEnum.OFF));
    }
/**
     * Verify that disconnect closes the socket
     */
Verify that disconnect closes the socket
Verify that disconnect closes the socket
@Test
    public void testDisconnect() throws IOException, InterruptedException
    {
        m_SUT.connectTimeService(m_StatusHandler, PORT);
        verify(m_ClientSocketFactory, timeout(1000))
            .createClientSocket(Mockito.anyString(), eq(PORT));
        m_SUT.disconnectTimeService();
        verify(m_ClientSocket).close();
        ArgumentCaptor<ComponentStatus> statusCaptor = ArgumentCaptor.forClass(ComponentStatus.class);
        verify(m_StatusHandler, timeout(1000).atLeast(1)).handleStatusUpdate(statusCaptor.capture());
        ComponentStatus status = statusCaptor.getValue();
        assertThat(status.getComponent().getType(), is(ComponentTypeEnum.SOFTWARE_UNIT));
        assertThat(status.getComponent().getDescription(), is("Time Service"));
        assertThat(status.getStatus().getSummary(), is(SummaryStatusEnum.OFF));
    }
@ Test public void testDisconnect ( ) throws IOException , InterruptedException { m_SUT . connectTimeService ( m_StatusHandler , PORT ) ; verify ( m_ClientSocketFactory , timeout ( 1000 ) ) . createClientSocket ( Mockito . anyString ( ) , eq ( PORT ) ) ; m_SUT . disconnectTimeService ( ) ; verify ( m_ClientSocket ) . close ( ) ; ArgumentCaptor < ComponentStatus > statusCaptor = ArgumentCaptor . forClass ( ComponentStatus . class ) ; verify ( m_StatusHandler , timeout ( 1000 ) . atLeast ( 1 ) ) . handleStatusUpdate ( statusCaptor . capture ( ) ) ; ComponentStatus status = statusCaptor . getValue ( ) ; assertThat ( status . getComponent ( ) . getType ( ) , is ( ComponentTypeEnum . SOFTWARE_UNIT ) ) ; assertThat ( status . getComponent ( ) . getDescription ( ) , is ( "Time Service" ) ) ; assertThat ( status . getStatus ( ) . getSummary ( ) , is ( SummaryStatusEnum . OFF ) ) ; }
Verify that disconnect closes the socket
Verify that disconnect closes the socket