### Question:
MessageList implements Serializable, Iterable<Message> { public MessageList getMessagesByMarker(@CheckForNull ValidationMarker marker) { return messages.stream() .filter(m -> (marker == null && !m.hasMarkers()) || marker != null && m.hasMarker(marker)) .collect(toMessageList()); } MessageList(@NonNull Message... messages); void add(Message message); void add(@CheckForNull MessageList messageList); boolean isEmpty(); int size(); Message getMessage(int index); Optional<Message> getFirstMessage(Severity errorLevel); Optional<Message> getMessageByCode(@CheckForNull String code); MessageList getMessagesByCode(@CheckForNull String code); Optional<Severity> getSeverity(); String getText(); boolean containsErrorMsg(); MessageList getMessagesFor(Object object); MessageList getMessagesFor(Object object, @CheckForNull String property); MessageList getMessagesFor(Object object, @CheckForNull String property, int index); MessageList getMessagesByMarker(@CheckForNull ValidationMarker marker); MessageList getMessagesByMarker(Predicate<ValidationMarker> markerPredicate); MessageList sortBySeverity(); Optional<Message> getMessageWithHighestSeverity(); @Override Iterator<Message> iterator(); void clear(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); Stream<Message> stream(); static Collector<Message, ?, MessageList> collector();  }### Answer:
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testGetMessagesByMarker_predicateNull_shouldThrowNullPointerException() { Assertions.assertThrows(NullPointerException.class, () -> { new MessageList().getMessagesByMarker((Predicate)null); }); }