@Test
public void testUnmarshalling() throws Exception {
ExpressionEditorMessageJSONUnmarshaller unmarshaller = new ExpressionEditorMessageJSONUnmarshaller();
ExpressionEditorMessage message = unmarshaller.unmarshall(ExpressionEditorMessageMarshallingTest.class.getResourceAsStream("condition_editor_message.json"));
assertNotNull("json message was not marshalled", message);
assertNotNull("condition expression was not marshalled", message.getExpression());
assertEquals("OR", message.getExpression().getOperator());
assertEquals(2, message.getExpression().getConditions().size());
assertEquals("isEquals", message.getExpression().getConditions().get(0).getFunction());
assertEquals("variableName1", message.getExpression().getConditions().get(0).getParameters().get(0));
assertEquals("param1.1", message.getExpression().getConditions().get(0).getParameters().get(1));
assertEquals("isBetween", message.getExpression().getConditions().get(1).getFunction());
assertEquals("variableName2", message.getExpression().getConditions().get(1).getParameters().get(0));
assertEquals("param2.1", message.getExpression().getConditions().get(1).getParameters().get(1));
assertEquals("param2.2", message.getExpression().getConditions().get(1).getParameters().get(2));
assertEquals("return true;", message.getScript());
assertEquals("The error code", message.getErrorCode());
assertEquals("The error message", message.getErrorMessage());
}