mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestAssetGetCommandModel.java
@Test
    public void testTrySetResponseByType()
    {
        List<CommandTypeEnum> types = new ArrayList<CommandTypeEnum>();
        types.add(CommandTypeEnum.GET_VERSION_COMMAND);
        
        m_SUT = new AssetGetCommandModel(m_Uuid, types);
        
        Date date = new Date(1);
        Response response = mock(Response.class);
        boolean answer = m_SUT.trySetResponseByType(CommandTypeEnum.SET_TUNE_SETTINGS_COMMAND, response, date);
        
        assertThat(answer, is(false));
        
        answer = m_SUT.trySetResponseByType(CommandTypeEnum.GET_VERSION_COMMAND, response, date);
        assertThat(answer, is(true));
        
        AssetGetCommandResponse commandResponse = m_SUT.getCommandResponseByType(CommandTypeEnum.GET_VERSION_COMMAND);
        assertThat(commandResponse, notNullValue());
        
        final SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss'Z'", Locale.getDefault());
        
        format.setTimeZone(TimeZone.getTimeZone("MM/dd/yyyy HH:mm:ss'Z'"));
        
        assertThat(commandResponse.printTimeMessage(), is(format.format(new Date(1))));
    }
/*
     * Verify that a response can be set for a given type.
     */
Verify that a response can be set for a given type.
Verify that a response can be set for a given type .
@Test
    public void testTrySetResponseByType()
    {
        List<CommandTypeEnum> types = new ArrayList<CommandTypeEnum>();
        types.add(CommandTypeEnum.GET_VERSION_COMMAND);
        m_SUT = new AssetGetCommandModel(m_Uuid, types);
        Date date = new Date(1);
        Response response = mock(Response.class);
        boolean answer = m_SUT.trySetResponseByType(CommandTypeEnum.SET_TUNE_SETTINGS_COMMAND, response, date);
        assertThat(answer, is(false));
        answer = m_SUT.trySetResponseByType(CommandTypeEnum.GET_VERSION_COMMAND, response, date);
        assertThat(answer, is(true));
        AssetGetCommandResponse commandResponse = m_SUT.getCommandResponseByType(CommandTypeEnum.GET_VERSION_COMMAND);
        assertThat(commandResponse, notNullValue());
        final SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss'Z'", Locale.getDefault());
        format.setTimeZone(TimeZone.getTimeZone("MM/dd/yyyy HH:mm:ss'Z'"));
        assertThat(commandResponse.printTimeMessage(), is(format.format(new Date(1))));
    }
@ Test public void testTrySetResponseByType ( ) { List < CommandTypeEnum > types = new ArrayList < CommandTypeEnum > ( ) ; types . add ( CommandTypeEnum . GET_VERSION_COMMAND ) ; m_SUT = new AssetGetCommandModel ( m_Uuid , types ) ; Date date = new Date ( 1 ) ; Response response = mock ( Response . class ) ; boolean answer = m_SUT . trySetResponseByType ( CommandTypeEnum . SET_TUNE_SETTINGS_COMMAND , response , date ) ; assertThat ( answer , is ( false ) ) ; answer = m_SUT . trySetResponseByType ( CommandTypeEnum . GET_VERSION_COMMAND , response , date ) ; assertThat ( answer , is ( true ) ) ; AssetGetCommandResponse commandResponse = m_SUT . getCommandResponseByType ( CommandTypeEnum . GET_VERSION_COMMAND ) ; assertThat ( commandResponse , notNullValue ( ) ) ; final SimpleDateFormat format = new SimpleDateFormat ( "MM/dd/yyyy HH:mm:ss'Z'" , Locale . getDefault ( ) ) ; format . setTimeZone ( TimeZone . getTimeZone ( "MM/dd/yyyy HH:mm:ss'Z'" ) ) ; assertThat ( commandResponse . printTimeMessage ( ) , is ( format . format ( new Date ( 1 ) ) ) ) ; }
Verify that a response can be set for a given type.
Verify that a response can be set for a given type .