Package Documentation for org.apache.commons.jexl3.junit Package

Using JEXL expressions in JUnit assertions.

- Introduction

## Introduction

This package only contains one class, Asserter, which allows you to use a JEXL expression in a JUnit assertion. The following example demonstrates the use of the Asserter class. An instance is created, and the internal JexlContext is populated via calls to setVariable(). Calls to assertExpression() succeed if the expression evaluates to the value of the second parameter, otherwise an AssertionFailedException is thrown.

       Asserter asserter = new Asserter();
       asserter.setVariable("foo", new Foo());
       asserter.setVariable("person", "James");

       asserter.assertExpression("person", "James");
       asserter.assertExpression("size(person)", new Integer(5));

       asserter.assertExpression("foo.getCount()", new Integer(5));
       asserter.assertExpression("foo.count", new Integer(5));