{
EvaluateBeanshell rule = new EvaluateBeanshell();
rule.setCondition( "${env} == null" );
rule.setMessage( "We have a variable : ${env}" );
ExpressionEvaluator eval = mock( ExpressionEvaluator.class );
when( eval.evaluate( rule.getCondition() ) ).thenThrow( new ExpressionEvaluationException( "expected error" ) );
try
{
EnforcerRuleHelper helper = EnforcerTestUtils.getHelper( project, eval );
rule.execute( helper );
fail( "Expected an exception." );