office1.setOfficeId("aaa");
emp1.setMatriculationCode("1");
office1.addEmployee(emp1);
Notification notification = new NotificationImpl();
assertFalse(this.compositeSpecification.compose(spec1).withMessage(new MessageImpl("wrong.office.id", Message.Type.WARNING, "Wrong Office Id"), false)
.and(spec2).withMessage(new MessageImpl("office.unavailable", Message.Type.WARNING, "Office Not Available"), false)
.evaluate(office1, notification));
assertFalse(notification.hasMessages(Message.Type.ERROR));
assertTrue(notification.hasMessages(Message.Type.WARNING));
assertFalse(notification.hasMessages(Message.Type.INFO));
assertTrue(notification.getMessages(Message.Type.WARNING).length == 1);
assertEquals("wrong.office.id", notification.getMessages(Message.Type.WARNING)[0].getCode());
assertEquals("Wrong Office Id", notification.getMessages(Message.Type.WARNING)[0].getDefaultMessage());
}