Package org.apache.myfaces.test.el

Examples of org.apache.myfaces.test.el.MockValueExpression


        requestBean.setScope("request");
        runtimeConfig.addManagedBean("requestBean", requestBean);
       
        try
        {
            new MockValueExpression("#{viewBean}", TestBean.class).getValue(facesContext.getELContext());
        }
        catch (FacesException e)
        {
            // success --> the ManagedBeanBuilder discovered the reference to a shorter lifetime
            return;
View Full Code Here


     */
    @SuppressWarnings("unchecked")
    public void testGetConvertedUISelectManyValuePrimitiveIntArray()
    {
        externalContext.getApplicationMap().put("bean", new Bean());
        ValueExpression expr = new MockValueExpression("#{bean.intArrayValue}", int[].class);
        uiSelectMany.setValueExpression("value", expr);
        Object target = _SharedRendererUtils.getConvertedUISelectManyValue(facesContext, uiSelectMany, submittedValue);
        assertTrue(target instanceof int[]);
        int[] array = (int[]) target;
        assertTrue(new Integer(submittedValue[0]).equals(array[0]));
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    public void testGetConvertedUISelectManyValueNonPrimitiveFloatArray()
    {
        externalContext.getApplicationMap().put("bean", new Bean());
        ValueExpression expr = new MockValueExpression("#{bean.floatArrayValue}", Float[].class);
        uiSelectMany.setValueExpression("value", expr);
        Object target = _SharedRendererUtils.getConvertedUISelectManyValue(facesContext, uiSelectMany, submittedValue);
        assertTrue(target instanceof Float[]);
        Float[] array = (Float[]) target;
        assertTrue(new Float(submittedValue[0]).equals(array[0]));
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    public void testGetConvertedUISelectManyValuePOJOArray()
    {
        externalContext.getApplicationMap().put("bean", new Bean());
        ValueExpression expr = new MockValueExpression("#{bean.pojoArrayValue}", POJO[].class);
        uiSelectMany.setValueExpression("value", expr);
        uiSelectMany.setConverter(pojoConverter);
        Object target = _SharedRendererUtils.getConvertedUISelectManyValue(facesContext, uiSelectMany, submittedValue);
        assertTrue(target instanceof POJO[]);
        POJO[] array = (POJO[]) target;
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    public void testGetConvertedUISelectManyValuePOJOCollectionWithoutCollectionType()
    {
        externalContext.getApplicationMap().put("bean", new Bean());
        ValueExpression expr = new MockValueExpression("#{bean.pojoCollectionValue}", Collection.class);
        uiSelectMany.setValueExpression("value", expr);
        uiSelectMany.setConverter(pojoConverter);
        Object target = _SharedRendererUtils.getConvertedUISelectManyValue(facesContext, uiSelectMany, submittedValue);
        assertTrue(target instanceof Collection);
        Collection collection = (Collection) target;
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    public void testGetConvertedUISelectManyValuePOJOCollectionWithCollectionType()
    {
        externalContext.getApplicationMap().put("bean", new Bean());
        ValueExpression expr = new MockValueExpression("#{bean.pojoCollectionValue}", Collection.class);
        uiSelectMany.setValueExpression("value", expr);
        uiSelectMany.setConverter(pojoConverter);
        uiSelectMany.getAttributes().put("collectionType", "java.util.HashSet");
        Object target = _SharedRendererUtils.getConvertedUISelectManyValue(facesContext, uiSelectMany, submittedValue);
        assertTrue(target instanceof HashSet);
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    public void testGetConvertedUISelectManyValueNoConverter()
    {
        externalContext.getApplicationMap().put("bean", new Bean());
        ValueExpression expr = new MockValueExpression("#{bean.pojoArrayValue}", POJO[].class);
        uiSelectMany.setValueExpression("value", expr);
        try
        {
            _SharedRendererUtils.getConvertedUISelectManyValue(facesContext, uiSelectMany, submittedValue);
            fail();
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    public void testGetConvertedUISelectManyValueWrongCollectionType()
    {
        externalContext.getApplicationMap().put("bean", new Bean());
        ValueExpression expr = new MockValueExpression("#{bean.pojoCollectionValue}", Collection.class);
        uiSelectMany.setValueExpression("value", expr);
        uiSelectMany.setConverter(pojoConverter);
        uiSelectMany.getAttributes().put("collectionType", "java.util.Collection");
        try
        {
View Full Code Here

        value.add("#3");
       
        UISelectItems selectItems = new UISelectItems();
        selectItems.setValue(value);
        selectItems.getAttributes().put("var", "item");
        ValueExpression itemValue = new MockValueExpression("#{item}", Object.class);
        selectItems.setValueExpression("itemValue" , itemValue);
       
        UISelectOne selectOne = new UISelectOne();
        selectOne.getChildren().add(selectItems);
       
View Full Code Here

        value[2] = 3;
       
        UISelectItems selectItems = new UISelectItems();
        selectItems.setValue(value);
        selectItems.getAttributes().put("var", "item");
        ValueExpression itemValue = new MockValueExpression("#{item}", Object.class);
        selectItems.setValueExpression("itemValue" , itemValue);
       
        UISelectOne selectOne = new UISelectOne();
        selectOne.getChildren().add(selectItems);
       
View Full Code Here

TOP

Related Classes of org.apache.myfaces.test.el.MockValueExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.