### Question:
ReflectionPropertyDispatcher implements PropertyDispatcher { @Override public MessageList getMessages(MessageList messageList) { Object boundObject = getBoundObject(); if (boundObject == null) { return new MessageList(); } else { MessageList msgListForBoundObject = messageList.getMessagesFor(boundObject, getProperty()); msgListForBoundObject.add(fallbackDispatcher.getMessages(messageList)); return msgListForBoundObject; } } ReflectionPropertyDispatcher(Supplier<?> boundObjectSupplier, String property,
            PropertyDispatcher fallbackDispatcher); @Override String getProperty(); @CheckForNull @Override Object getBoundObject(); @Override Class<?> getValueClass(); @Override @SuppressWarnings("unchecked") V pull(Aspect<V> aspect); @Override void push(Aspect<V> aspect); @Override boolean isPushable(Aspect<V> aspect); @Override MessageList getMessages(MessageList messageList); @Override String toString();  }### Answer:
@Test public void testGetMessages_Empty() { MessageList messageList = new MessageList(); assertThat(setupPmoDispatcher(XYZ).getMessages(messageList), emptyMessageList()); assertThat(setupPmoDispatcher("invalidProperty").getMessages(messageList), emptyMessageList()); }
@Test public void testGetMessages_ShouldReturnMessagesFromModelObject() { MessageList messageList = new MessageList(); Message msg1 = Message.builder(ABC, Severity.ERROR).invalidObjectWithProperties(testModelObject, XYZ) .create(); Message msg2 = Message.builder(ABC, Severity.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()); }
@Test public void testGetMessages_ShouldReturnMessagesFromPmo() { MessageList messageList = new MessageList(); Message msg1 = Message.builder(ABC, Severity.ERROR).invalidObjectWithProperties(testPmo, XYZ).create(); Message msg2 = Message.builder(ABC, Severity.ERROR).invalidObjectWithProperties(testPmo, ABC).create(); Message msg3 = Message.builder(ABC, Severity.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()); }
@Test public void testGetMessages_IgnoreIrrelevantMessages() { MessageList messageList = new MessageList(); Message msg1 = Message.builder(ABC, Severity.ERROR).invalidObjectWithProperties(new Object(), XYZ).create(); Message msg2 = Message.builder(ABC, Severity.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()); }