@Test
public void testBindingsAreBoundOnlyWhenEvaluation() {

    GroovyScriptEngine groovyScriptEngine = new GroovyScriptEngine();
    String groovyExpression = "temperature > 10 && humidity < 30";
    GroovyScript<Boolean> groovyScript = new GroovyScript<Boolean>(groovyExpression, groovyScriptEngine);
    HashMap<String, Object> fieldsAndValue = new HashMap<>();
    fieldsAndValue.put("temperature", 20);
    fieldsAndValue.put("humidity", 10);
    try {
        assertTrue(groovyScript.evaluate(StreamlineEventImpl.builder().fieldsAndValues(fieldsAndValue).dataSourceId("1").build()));
    } catch (ScriptException e) {
        e.printStackTrace();
        Assert.fail("It shouldn't throw ScriptException");
    }
    fieldsAndValue.clear();
    fieldsAndValue.put("no_related_field", 3);
    try {
        groovyScript.evaluate(StreamlineEventImpl.builder().fieldsAndValues(fieldsAndValue).dataSourceId("1").build());
        // it means that previous bound variables are used now
        Assert.fail("It should not evaluate correctly");
    } catch (ScriptException e) {
        // no-op, that's what we want
    }
}