Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package org.apache.commons.jexl.junit

Using JEXL expressions in JUnit assertions

See:
Description

Class Summary
Asserter | A utility class for performing JUnit based assertions using Jexl expressions.

## Package org.apache.commons.jexl.junit Description

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));

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

Copyright © 2003-2004 The Apache Software Foundation. All Rights Reserved.