mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/advanced/configuration/TestConfigPropModelImpl.java
@Test
    public void testSetValue()
    {
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.LONG);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue(5L);
        assertThat(m_SUT.getValue(), is((Object)5L));
        
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.INTEGER);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue(25);
        assertThat(m_SUT.getValue(), is((Object)25));
        
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.SHORT);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue((short)10);
        assertThat(m_SUT.getValue(), is((Object)(short)10));

        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.BYTE);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue((byte)120);
        assertThat(m_SUT.getValue(), is((Object)(byte)120));
        
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.DOUBLE);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue(1.22);
        assertThat(m_SUT.getValue(), is((Object)1.22));
        
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.FLOAT);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue(12.5f);
        assertThat(m_SUT.getValue(), is((Object)12.5f));
        
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.BOOLEAN);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue(true);
        assertThat(m_SUT.getValue(), is((Object)true));
        
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.CHARACTER);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue('A');
        assertThat(m_SUT.getValue(), is((Object)'A'));
        
        //test invalid types
        m_SUT.setValue(null);
        assertThat(m_SUT.getValue(), is((Object)m_DefaultValues));
        m_SUT.setValue("");
        assertThat(m_SUT.getValue(), is((Object)""));
    }
/**
     * Test the set value method.
     * Verify that all value types can be set appropriately.
     */
Test the set value method.
Verify that all value types can be set appropriately.
Test the set value method . Verify that all value types can be set appropriately .
@Test
    public void testSetValue()
    {
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.LONG);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue(5L);
        assertThat(m_SUT.getValue(), is((Object)5L));
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.INTEGER);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue(25);
        assertThat(m_SUT.getValue(), is((Object)25));
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.SHORT);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue((short)10);
        assertThat(m_SUT.getValue(), is((Object)(short)10));
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.BYTE);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue((byte)120);
        assertThat(m_SUT.getValue(), is((Object)(byte)120));
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.DOUBLE);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue(1.22);
        assertThat(m_SUT.getValue(), is((Object)1.22));
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.FLOAT);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue(12.5f);
        assertThat(m_SUT.getValue(), is((Object)12.5f));
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.BOOLEAN);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue(true);
        assertThat(m_SUT.getValue(), is((Object)true));
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.CHARACTER);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        m_SUT.setValue('A');
        assertThat(m_SUT.getValue(), is((Object)'A'));
        m_SUT.setValue(null);
        assertThat(m_SUT.getValue(), is((Object)m_DefaultValues));
        m_SUT.setValue("");
        assertThat(m_SUT.getValue(), is((Object)""));
    }
@ Test public void testSetValue ( ) { when ( m_AttributeModel . getType ( ) ) . thenReturn ( AttributeDefinition . LONG ) ; m_SUT = new ConfigPropModelImpl ( m_AttributeModel ) ; m_SUT . setValue ( 5L ) ; assertThat ( m_SUT . getValue ( ) , is ( ( Object ) 5L ) ) ; when ( m_AttributeModel . getType ( ) ) . thenReturn ( AttributeDefinition . INTEGER ) ; m_SUT = new ConfigPropModelImpl ( m_AttributeModel ) ; m_SUT . setValue ( 25 ) ; assertThat ( m_SUT . getValue ( ) , is ( ( Object ) 25 ) ) ; when ( m_AttributeModel . getType ( ) ) . thenReturn ( AttributeDefinition . SHORT ) ; m_SUT = new ConfigPropModelImpl ( m_AttributeModel ) ; m_SUT . setValue ( ( short ) 10 ) ; assertThat ( m_SUT . getValue ( ) , is ( ( Object ) ( short ) 10 ) ) ; when ( m_AttributeModel . getType ( ) ) . thenReturn ( AttributeDefinition . BYTE ) ; m_SUT = new ConfigPropModelImpl ( m_AttributeModel ) ; m_SUT . setValue ( ( byte ) 120 ) ; assertThat ( m_SUT . getValue ( ) , is ( ( Object ) ( byte ) 120 ) ) ; when ( m_AttributeModel . getType ( ) ) . thenReturn ( AttributeDefinition . DOUBLE ) ; m_SUT = new ConfigPropModelImpl ( m_AttributeModel ) ; m_SUT . setValue ( 1.22 ) ; assertThat ( m_SUT . getValue ( ) , is ( ( Object ) 1.22 ) ) ; when ( m_AttributeModel . getType ( ) ) . thenReturn ( AttributeDefinition . FLOAT ) ; m_SUT = new ConfigPropModelImpl ( m_AttributeModel ) ; m_SUT . setValue ( 12.5f ) ; assertThat ( m_SUT . getValue ( ) , is ( ( Object ) 12.5f ) ) ; when ( m_AttributeModel . getType ( ) ) . thenReturn ( AttributeDefinition . BOOLEAN ) ; m_SUT = new ConfigPropModelImpl ( m_AttributeModel ) ; m_SUT . setValue ( true ) ; assertThat ( m_SUT . getValue ( ) , is ( ( Object ) true ) ) ; when ( m_AttributeModel . getType ( ) ) . thenReturn ( AttributeDefinition . CHARACTER ) ; m_SUT = new ConfigPropModelImpl ( m_AttributeModel ) ; m_SUT . setValue ( 'A' ) ; assertThat ( m_SUT . getValue ( ) , is ( ( Object ) 'A' ) ) ; m_SUT . setValue ( null ) ; assertThat ( m_SUT . getValue ( ) , is ( ( Object ) m_DefaultValues ) ) ; m_SUT . setValue ( "" ) ; assertThat ( m_SUT . getValue ( ) , is ( ( Object ) "" ) ) ; }
Test the set value method.
Test the set value method .
//test invalid types