2 Replies Latest reply on Mar 5, 2010 10:34 PM by Amine Trabelsi

    Creating an EL expression in a Seam unit test

    Amine Trabelsi Newbie

      I need to write a unit test that creates a list of FilterField.

      private List<FilterField> createSampleFilters() {
        List<FilterField> filters = new ArrayList<FilterField>();
        ExtendedFilterField filtre = 
          new ExtendedFilterField(
        return filters;
      private Expression getExpression(String exp) {
        ELContext context = 
        return ExpressionFactory.newInstance().
                 createValueExpression(context, exp, String.class);

      MY PROBLEM is that FacesContext.getCurrentInstance() throws a NullPointerException !

      I tried to create a FacesContext instance with MockFacesContextFactory but it doesn't work either :-/

      Does anyone have a clue to create a FilterField or a javax.el.Expression or a non null facesContext in a seam unit test ???