All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.commons.jexl.junit.package.html Maven / Gradle / Ivy

Go to download

Jexl is an implementation of the JSTL Expression Language with extensions.

There is a newer version: 1.1-hudson-20090508
Show newest version

 
  Package Documentation for org.apache.commons.jexl.junit Package
 
 
  Using JEXL expressions in JUnit assertions.
  

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy