### Question:
BehaviorDependentDispatcher extends AbstractPropertyDispatcherDecorator { @Override public MessageList getMessages(MessageList messageList) { if (isConsensus(forBoundObjectAndProperty(PropertyBehavior::isShowValidationMessages))) { return super.getMessages(messageList); } else { return new MessageList(); } } BehaviorDependentDispatcher(PropertyDispatcher wrappedDispatcher,
            PropertyBehaviorProvider provider); @Override MessageList getMessages(MessageList messageList); @SuppressWarnings("unchecked") @Override T pull(Aspect<T> aspect); @Override boolean isPushable(Aspect<T> aspect);  }### Answer:
@Test public void testNullBoundObject_messages() { wrappedDispatcher.setBoundObject(null); behaviorDispatcher = new BehaviorDependentDispatcher(wrappedDispatcher, PropertyBehaviorProvider.with(PropertyBehavior.showValidationMessages(() -> false))); Assertions.assertThrows(NullPointerException.class, () -> { behaviorDispatcher.getMessages(new MessageList()); }); }
@Test public void testNonConsensus_messages() { behaviorDispatcher = new BehaviorDependentDispatcher(wrappedDispatcher, PropertyBehaviorProvider.with(PropertyBehavior.showValidationMessages(() -> false))); MessageList messageList = new MessageList(Message.builder("Foo", Severity.ERROR) .invalidObject(new ObjectProperty(wrappedDispatcher.getBoundObject(), "prop")).code("4711").create()); assertThat(behaviorDispatcher.getMessages(messageList), is(emptyMessageList())); }