edu.udayton.udri.asset.novatel/test/edu/udayton/udri/asset/novatel/impl/timechanger/TestTimeChangeImpl.java
@Test
    public void testHeartbeatSignal() throws InterruptedException, IllegalStateException, IOException
    {
        m_SUT.connectTimeService(m_StatusHandler, PORT);
        
        //Wait up to 6 seconds to allow the poll for time data to timeout so that heartbeat
        //message will be sent.
        ArgumentCaptor<byte[]> byteCaptor = ArgumentCaptor.forClass(byte[].class);
        verify(m_Stream, timeout(6000).atLeast(1)).write(byteCaptor.capture());
        
        m_SUT.disconnectTimeService();
        
        assertThat(byteCaptor.getValue(), notNullValue());
        
        ByteBuffer buffer = ByteBuffer.wrap(byteCaptor.getValue());
        assertThat(-22L, is(buffer.getLong()));
    }
/**
     * Verify that a heartbeat signal will be sent if no data is received to change the system time.
     */
Verify that a heartbeat signal will be sent if no data is received to change the system time.
Verify that a heartbeat signal will be sent if no data is received to change the system time .
@Test
    public void testHeartbeatSignal() throws InterruptedException, IllegalStateException, IOException
    {
        m_SUT.connectTimeService(m_StatusHandler, PORT);
        ArgumentCaptor<byte[]> byteCaptor = ArgumentCaptor.forClass(byte[].class);
        verify(m_Stream, timeout(6000).atLeast(1)).write(byteCaptor.capture());
        m_SUT.disconnectTimeService();
        assertThat(byteCaptor.getValue(), notNullValue());
        ByteBuffer buffer = ByteBuffer.wrap(byteCaptor.getValue());
        assertThat(-22L, is(buffer.getLong()));
    }
@ Test public void testHeartbeatSignal ( ) throws InterruptedException , IllegalStateException , IOException { m_SUT . connectTimeService ( m_StatusHandler , PORT ) ; ArgumentCaptor < byte [ ] > byteCaptor = ArgumentCaptor . forClass ( byte [ ] . class ) ; verify ( m_Stream , timeout ( 6000 ) . atLeast ( 1 ) ) . write ( byteCaptor . capture ( ) ) ; m_SUT . disconnectTimeService ( ) ; assertThat ( byteCaptor . getValue ( ) , notNullValue ( ) ) ; ByteBuffer buffer = ByteBuffer . wrap ( byteCaptor . getValue ( ) ) ; assertThat ( - 22L , is ( buffer . getLong ( ) ) ) ; }
Verify that a heartbeat signal will be sent if no data is received to change the system time.
Verify that a heartbeat signal will be sent if no data is received to change the system time .
//Wait up to 6 seconds to allow the poll for time data to timeout so that heartbeat //message will be sent.