public void testRuleOnCommand() throws Exception {
Person person = new Person();
person.setName("Young Scott");
person.setAge(18);
ExecutionResultImpl response = ruleOnCommandEndpoint.requestBody(person, ExecutionResultImpl.class);
assertNotNull(response);
// Expecting single result value of type Person
Collection<String> identifiers = response.getIdentifiers();
assertNotNull(identifiers);
assertTrue(identifiers.size() >= 1);
for (String identifier : identifiers) {
final Object value = response.getValue(identifier);
assertNotNull(value);
assertIsInstanceOf(Person.class, value);
assertFalse(((Person) value).isCanDrink());
System.out.println(identifier + " = " + value);
}
// Test for alternative result
person.setName("Scott");
person.setAge(21);
response = ruleOnCommandEndpoint.requestBody(person, ExecutionResultImpl.class);
assertNotNull(response);
// Expecting single result value of type Person
identifiers = response.getIdentifiers();
assertNotNull(identifiers);
assertTrue(identifiers.size() >= 1);
for (String identifier : identifiers) {
final Object value = response.getValue(identifier);
assertNotNull(value);
assertIsInstanceOf(Person.class, value);
assertTrue(((Person) value).isCanDrink());
System.out.println(identifier + " = " + value);
}