use of org.linkki.core.message.MessageList in project linkki by linkki-framework.
the class BindingManagerTest method testAfterUpdateUi_sortsMessagesByErrorLevel.
@Test
public void testAfterUpdateUi_sortsMessagesByErrorLevel() {
Message e1 = Message.newError("e1", "E1");
Message e2 = Message.newError("e2", "E2");
Message e3 = Message.newError("e3", "E3");
Message w1 = Message.newWarning("w1", "W1");
Message w2 = Message.newWarning("w2", "W2");
Message i1 = Message.newInfo("i1", "I1");
Message i2 = Message.newInfo("i2", "I2");
MessageList unsortedMessageList = new MessageList(i2, e1, w1, e3, i1, e2, w2);
MessageList sortedMessageList = new MessageList(e1, e3, e2, w1, w2, i2, i1);
validationService = () -> unsortedMessageList;
TestBindingManager bindingManager = new TestBindingManager(validationService);
TestBindingContext context = bindingManager.startNewContext("foo");
bindingManager.afterUpdateUi();
assertThat(context.messages, is(equalTo(sortedMessageList)));
}
use of org.linkki.core.message.MessageList in project linkki by linkki-framework.
the class AbstractPropertyDispatcherDecoratorTest method testMessages.
@Test
public void testMessages() {
MessageList messageList = new MessageList();
decorator.getMessages(messageList);
verify(wrappedDispatcher).getMessages(messageList);
}
use of org.linkki.core.message.MessageList in project linkki by linkki-framework.
the class ReflectionPropertyDispatcherTest method testGetMessages_ShouldReturnMessagesFromPmo.
@Test
public void testGetMessages_ShouldReturnMessagesFromPmo() {
MessageList messageList = new MessageList();
Message msg1 = Message.builder(ABC, ErrorLevel.ERROR).invalidObjectWithProperties(testPmo, XYZ).create();
Message msg2 = Message.builder(ABC, ErrorLevel.ERROR).invalidObjectWithProperties(testPmo, ABC).create();
Message msg3 = Message.builder(ABC, ErrorLevel.ERROR).invalidObjectWithProperties(testModelObject, XYZ).create();
messageList.add(msg1);
messageList.add(msg2);
messageList.add(msg3);
assertThat(setupPmoDispatcher(XYZ).getMessages(messageList), hasSize(2));
assertThat(setupPmoDispatcher(ABC).getMessages(messageList), hasSize(1));
assertThat(setupPmoDispatcher("invalidProperty").getMessages(messageList), emptyMessageList());
}
use of org.linkki.core.message.MessageList in project linkki by linkki-framework.
the class ReflectionPropertyDispatcherTest method testGetMessages_ShouldReturnMessagesFromModelObject.
@Test
public void testGetMessages_ShouldReturnMessagesFromModelObject() {
MessageList messageList = new MessageList();
Message msg1 = Message.builder(ABC, ErrorLevel.ERROR).invalidObjectWithProperties(testModelObject, XYZ).create();
Message msg2 = Message.builder(ABC, ErrorLevel.ERROR).invalidObjectWithProperties(testModelObject, ABC).create();
messageList.add(msg1);
messageList.add(msg2);
assertThat(setupPmoDispatcher(XYZ).getMessages(messageList), hasSize(1));
assertThat(setupPmoDispatcher(ABC).getMessages(messageList), hasSize(1));
assertThat(setupPmoDispatcher("invalidProperty").getMessages(messageList), emptyMessageList());
}
use of org.linkki.core.message.MessageList in project linkki by linkki-framework.
the class ReflectionPropertyDispatcherTest method testGetMessages_empty.
@Test
public void testGetMessages_empty() {
MessageList messageList = new MessageList();
assertThat(setupPmoDispatcher(XYZ).getMessages(messageList), emptyMessageList());
assertThat(setupPmoDispatcher("invalidProperty").getMessages(messageList), emptyMessageList());
}
Aggregations