use of org.linkki.core.message.MessageList in project linkki by linkki-framework.
the class ComponentBindingTest method setUp.
@Before
public void setUp() {
propertyDispatcherValue = mock(PropertyDispatcher.class);
when(propertyDispatcherValue.getProperty()).thenReturn("value");
propertyDispatcherEnumValue = mock(PropertyDispatcher.class);
when(propertyDispatcherEnumValue.getProperty()).thenReturn("enumValue");
doReturn(TestEnum.class).when(propertyDispatcherEnumValue).getValueClass();
messageList = new MessageList();
when(propertyDispatcherValue.getMessages(any(MessageList.class))).thenReturn(messageList);
when(propertyDispatcherEnumValue.getMessages(any(MessageList.class))).thenReturn(messageList);
selectBinding = new ComponentBinding(new LabelComponentWrapper(label, selectField), propertyDispatcherEnumValue, Handler.NOP_HANDLER, new ArrayList<>());
}
use of org.linkki.core.message.MessageList in project linkki by linkki-framework.
the class ReflectionPropertyDispatcherTest method testGetMessages_IgnoreIrrelevantMessages.
@Test
public void testGetMessages_IgnoreIrrelevantMessages() {
MessageList messageList = new MessageList();
Message msg1 = Message.builder(ABC, ErrorLevel.ERROR).invalidObjectWithProperties(new Object(), XYZ).create();
Message msg2 = Message.builder(ABC, ErrorLevel.ERROR).invalidObjectWithProperties(new Object(), ABC).create();
messageList.add(msg1);
messageList.add(msg2);
assertThat(setupPmoDispatcher(XYZ).getMessages(messageList), emptyMessageList());
assertThat(setupPmoDispatcher(ABC).getMessages(messageList), emptyMessageList());
assertThat(setupPmoDispatcher("invalidProperty").getMessages(messageList), emptyMessageList());
}
use of org.linkki.core.message.MessageList in project linkki by linkki-framework.
the class ValidationDisplayStateTest method testFilter.
@Test
public void testFilter() {
ValidationMarker mandatoryFieldMarker = () -> true;
ValidationMarker nonMandatoryFieldMarker = () -> false;
Message m1 = Message.builder("m1", ErrorLevel.ERROR).markers(mandatoryFieldMarker).create();
Message m2 = Message.builder("m2", ErrorLevel.ERROR).markers(nonMandatoryFieldMarker).create();
Message m3 = Message.builder("m3", ErrorLevel.ERROR).create();
MessageList messages = new MessageList(m1, m2, m3);
assertThat(SHOW_ALL.filter(messages), contains(m1, m2, m3));
assertThat(HIDE_MANDATORY_FIELD_VALIDATIONS.filter(messages), contains(m2, m3));
}
Aggregations