edu.udayton.udri.asset.novatel/test/edu/udayton/udri/asset/novatel/impl/timechanger/TestTimeChangeImpl.java
@Test
    public void testChangeTime() throws InterruptedException, AssetException, IllegalStateException, IOException
    {
        m_SUT.connectTimeService(m_StatusHandler, PORT);
        
        long time = System.currentTimeMillis();
        Thread.sleep(1000);
        
        m_SUT.changeTime(time);
        
        long secondTime = System.currentTimeMillis();
        m_SUT.changeTime(secondTime);
        
        ArgumentCaptor<byte[]> byteCaptor = ArgumentCaptor.forClass(byte[].class);
        verify(m_Stream, timeout(1000)).write(byteCaptor.capture());
        
        assertThat(byteCaptor.getValue(), notNullValue());
        
        ByteBuffer buffer = ByteBuffer.wrap(byteCaptor.getValue());
        assertThat(time, is(buffer.getLong()));
    }
/**
     * Verify that the time can be changed when called in the proper order.
     */
Verify that the time can be changed when called in the proper order.
Verify that the time can be changed when called in the proper order .
@Test
    public void testChangeTime() throws InterruptedException, AssetException, IllegalStateException, IOException
    {
        m_SUT.connectTimeService(m_StatusHandler, PORT);
        long time = System.currentTimeMillis();
        Thread.sleep(1000);
        m_SUT.changeTime(time);
        long secondTime = System.currentTimeMillis();
        m_SUT.changeTime(secondTime);
        ArgumentCaptor<byte[]> byteCaptor = ArgumentCaptor.forClass(byte[].class);
        verify(m_Stream, timeout(1000)).write(byteCaptor.capture());
        assertThat(byteCaptor.getValue(), notNullValue());
        ByteBuffer buffer = ByteBuffer.wrap(byteCaptor.getValue());
        assertThat(time, is(buffer.getLong()));
    }
@ Test public void testChangeTime ( ) throws InterruptedException , AssetException , IllegalStateException , IOException { m_SUT . connectTimeService ( m_StatusHandler , PORT ) ; long time = System . currentTimeMillis ( ) ; Thread . sleep ( 1000 ) ; m_SUT . changeTime ( time ) ; long secondTime = System . currentTimeMillis ( ) ; m_SUT . changeTime ( secondTime ) ; ArgumentCaptor < byte [ ] > byteCaptor = ArgumentCaptor . forClass ( byte [ ] . class ) ; verify ( m_Stream , timeout ( 1000 ) ) . write ( byteCaptor . capture ( ) ) ; assertThat ( byteCaptor . getValue ( ) , notNullValue ( ) ) ; ByteBuffer buffer = ByteBuffer . wrap ( byteCaptor . getValue ( ) ) ; assertThat ( time , is ( buffer . getLong ( ) ) ) ; }
Verify that the time can be changed when called in the proper order.
Verify that the time can be changed when called in the proper order .