mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestCommandNodeModel.java
@Test
    public void testValidateValue()
    {
        FacesContext context = mock(FacesContext.class);
        UIComponent component = mock(UIComponent.class);
        PowerMockito.mockStatic(ArgumentValidatorUtil.class);
        
        try
        {
            m_SUT.setType(Integer.class);
            m_SUT.validateValue(context, component, null);
        }
        catch (ValidatorException exception)
        {
            fail("Validation should have succeeded.");
        }
        
        try
        {
            m_SUT.setType(Integer.class);
            m_SUT.validateValue(context, component, "");
        }
        catch (ValidatorException exception)
        {
            fail("Validation should have succeeded.");
        }
        
        Object value = "Value doesn't matter!";
        try
        {
            m_SUT.setType(int.class);
            PowerMockito.when(ArgumentValidatorUtil.isValidValue((String)value, null, null, int.class)).
                thenReturn(ValidationEnum.PARSING_FAILURE);
            
            m_SUT.validateValue(context, component, value);
            fail("Validation exception should be thrown.");
        }
        catch (ValidatorException exception)
        {
            //ExpectedException
            assertThat(exception.getFacesMessage().getSummary(), is("Value Invalid Type!"));
        }
        
        try
        {
            m_SUT.setType(int.class);
            PowerMockito.when(ArgumentValidatorUtil.isValidValue((String)value, null, null, int.class)).
                thenReturn(ValidationEnum.PASSED);
            
            m_SUT.validateValue(context, component, value);
        }
        catch (ValidatorException exception)
        {
            fail("Validation should have succeeded.");
        }
    }
/**
     * Test the validate value method.
     * Verify validation passes and fails when appropriate.
     */
Test the validate value method.
Verify validation passes and fails when appropriate.
Test the validate value method . Verify validation passes and fails when appropriate .
@Test
    public void testValidateValue()
    {
        FacesContext context = mock(FacesContext.class);
        UIComponent component = mock(UIComponent.class);
        PowerMockito.mockStatic(ArgumentValidatorUtil.class);
        try
        {
            m_SUT.setType(Integer.class);
            m_SUT.validateValue(context, component, null);
        }
        catch (ValidatorException exception)
        {
            fail("Validation should have succeeded.");
        }
        try
        {
            m_SUT.setType(Integer.class);
            m_SUT.validateValue(context, component, "");
        }
        catch (ValidatorException exception)
        {
            fail("Validation should have succeeded.");
        }
        Object value = "Value doesn't matter!";
        try
        {
            m_SUT.setType(int.class);
            PowerMockito.when(ArgumentValidatorUtil.isValidValue((String)value, null, null, int.class)).
                thenReturn(ValidationEnum.PARSING_FAILURE);
            m_SUT.validateValue(context, component, value);
            fail("Validation exception should be thrown.");
        }
        catch (ValidatorException exception)
        {
            assertThat(exception.getFacesMessage().getSummary(), is("Value Invalid Type!"));
        }
        try
        {
            m_SUT.setType(int.class);
            PowerMockito.when(ArgumentValidatorUtil.isValidValue((String)value, null, null, int.class)).
                thenReturn(ValidationEnum.PASSED);
            m_SUT.validateValue(context, component, value);
        }
        catch (ValidatorException exception)
        {
            fail("Validation should have succeeded.");
        }
    }
@ Test public void testValidateValue ( ) { FacesContext context = mock ( FacesContext . class ) ; UIComponent component = mock ( UIComponent . class ) ; PowerMockito . mockStatic ( ArgumentValidatorUtil . class ) ; try { m_SUT . setType ( Integer . class ) ; m_SUT . validateValue ( context , component , null ) ; } catch ( ValidatorException exception ) { fail ( "Validation should have succeeded." ) ; } try { m_SUT . setType ( Integer . class ) ; m_SUT . validateValue ( context , component , "" ) ; } catch ( ValidatorException exception ) { fail ( "Validation should have succeeded." ) ; } Object value = "Value doesn't matter!" ; try { m_SUT . setType ( int . class ) ; PowerMockito . when ( ArgumentValidatorUtil . isValidValue ( ( String ) value , null , null , int . class ) ) . thenReturn ( ValidationEnum . PARSING_FAILURE ) ; m_SUT . validateValue ( context , component , value ) ; fail ( "Validation exception should be thrown." ) ; } catch ( ValidatorException exception ) { assertThat ( exception . getFacesMessage ( ) . getSummary ( ) , is ( "Value Invalid Type!" ) ) ; } try { m_SUT . setType ( int . class ) ; PowerMockito . when ( ArgumentValidatorUtil . isValidValue ( ( String ) value , null , null , int . class ) ) . thenReturn ( ValidationEnum . PASSED ) ; m_SUT . validateValue ( context , component , value ) ; } catch ( ValidatorException exception ) { fail ( "Validation should have succeeded." ) ; } }
Test the validate value method.
Test the validate value method .
//ExpectedException