MyFaces Test
  1. MyFaces Test
  2. MYFACESTEST-4

Unable to call setValue of ValueExpression in test

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      See attached JUnit test case which fails with myfaces-test20-1.0.0-SNAPSHOT
      Tested with Mojarra-2.0.2

      Description

      Components tested inside a test case inherited from AbstractJsfTestCase are not able to do following:

      ELContext elContext = facesContext.getELContext();
      ValueExpression ve = application.getExpressionFactory().createValueExpression(elContext, "#

      {foo}

      ", String.class);
      ve.setValue(elContext, "BAR");

      The error is caused by the FacesResourceBundleELResolver inside the setValue method, where it tries to get a ResourceBundle from MockApplication12 for the given ValueExpression. Unfortunately the MockApplication12 getResourceBundle method throws a MissingResourceException instead of returning null.

      Please apply attached patch to the code base.

      1. MockApplication12.patch
        0.8 kB
        Christoph Göldner
      2. ValueExpressionTest.java
        1 kB
        Christoph Göldner

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Patch Available Patch Available
        1m 24s 1 Christoph Göldner 15/Mar/10 08:51
        Patch Available Patch Available Resolved Resolved
        9h 2m 1 Jakob Korherr 15/Mar/10 17:53
        Resolved Resolved Closed Closed
        519d 11h 28m 1 Leonardo Uribe 17/Aug/11 05:21
        Leonardo Uribe made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Jakob Korherr made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Jakob Korherr added a comment -

        Oh, I almost forgot: The MyFaces test code for 2.0 uses most of the parts of MyFaces test 1.2. Also the class for which you provided the patch (MockApplication12) is from MyFaces test 1.2. So there is no need to change this twice!

        Show
        Jakob Korherr added a comment - Oh, I almost forgot: The MyFaces test code for 2.0 uses most of the parts of MyFaces test 1.2. Also the class for which you provided the patch (MockApplication12) is from MyFaces test 1.2. So there is no need to change this twice!
        Hide
        Jakob Korherr added a comment -

        Thank you very much for the patch and the test case for this one and also for MYFACESTEST-5, Christoph.

        However, please try to follow the code guidelines of MyFaces in your next patch(es). I know, the code in MyFaces test does not really do this either, but if we keep on committing the code in any style, it will become a bigger mess with every commit.

        Show
        Jakob Korherr added a comment - Thank you very much for the patch and the test case for this one and also for MYFACESTEST-5 , Christoph. However, please try to follow the code guidelines of MyFaces in your next patch(es). I know, the code in MyFaces test does not really do this either, but if we keep on committing the code in any style, it will become a bigger mess with every commit.
        Jakob Korherr made changes -
        Assignee Jakob Korherr [ jakobkorherr ]
        Hide
        Christoph Göldner added a comment -

        I assume that it also fails with JSF 1.2 implementations

        Show
        Christoph Göldner added a comment - I assume that it also fails with JSF 1.2 implementations
        Christoph Göldner made changes -
        Attachment MockApplication12.patch [ 12438800 ]
        Hide
        Christoph Göldner added a comment -

        Patch file

        Show
        Christoph Göldner added a comment - Patch file
        Christoph Göldner made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Christoph Göldner made changes -
        Field Original Value New Value
        Attachment ValueExpressionTest.java [ 12438799 ]
        Hide
        Christoph Göldner added a comment -

        JUnit test case

        Show
        Christoph Göldner added a comment - JUnit test case
        Christoph Göldner created issue -

          People

          • Assignee:
            Jakob Korherr
            Reporter:
            Christoph Göldner
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development