mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/advanced/configuration/TestConfigPropModelImpl.java
@Test
    public void testValidateValue()
    {
        FacesContext context = mock(FacesContext.class);
        UIComponent component = mock(UIComponent.class);
        
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.INTEGER);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        
        try
        {
            m_SUT.validateValue(context, component, "not int");
            fail("Validation exception should be thrown.");
        }
        catch (ValidatorException exception)
        {
            //ExpectedException
            assertThat(exception.getFacesMessage().getSummary(), is("Value Invalid Type!"));
        }
        
        try
        {
            m_SUT.validateValue(context, component, "34");
        }
        catch (ValidatorException exception)
        {
            fail("Validation should have passed and therefore no exception should be thrown.");
        }
    }
/**
     * Test the validate value method.
     * Verify that method takes the appropriate action depending on whether value is valid or not.
     */
Test the validate value method.
Verify that method takes the appropriate action depending on whether value is valid or not.
Test the validate value method . Verify that method takes the appropriate action depending on whether value is valid or not .
@Test
    public void testValidateValue()
    {
        FacesContext context = mock(FacesContext.class);
        UIComponent component = mock(UIComponent.class);
        when(m_AttributeModel.getType()).thenReturn(AttributeDefinition.INTEGER);
        m_SUT = new ConfigPropModelImpl(m_AttributeModel);
        try
        {
            m_SUT.validateValue(context, component, "not int");
            fail("Validation exception should be thrown.");
        }
        catch (ValidatorException exception)
        {
            assertThat(exception.getFacesMessage().getSummary(), is("Value Invalid Type!"));
        }
        try
        {
            m_SUT.validateValue(context, component, "34");
        }
        catch (ValidatorException exception)
        {
            fail("Validation should have passed and therefore no exception should be thrown.");
        }
    }
@ Test public void testValidateValue ( ) { FacesContext context = mock ( FacesContext . class ) ; UIComponent component = mock ( UIComponent . class ) ; when ( m_AttributeModel . getType ( ) ) . thenReturn ( AttributeDefinition . INTEGER ) ; m_SUT = new ConfigPropModelImpl ( m_AttributeModel ) ; try { m_SUT . validateValue ( context , component , "not int" ) ; fail ( "Validation exception should be thrown." ) ; } catch ( ValidatorException exception ) { assertThat ( exception . getFacesMessage ( ) . getSummary ( ) , is ( "Value Invalid Type!" ) ) ; } try { m_SUT . validateValue ( context , component , "34" ) ; } catch ( ValidatorException exception ) { fail ( "Validation should have passed and therefore no exception should be thrown." ) ; } }
Test the validate value method.
Test the validate value method .
//ExpectedException