### Question:
InMemoryMessageVerifier { public static boolean messageTypeSent(final InMemoryMessageSender<TypedMessage> inMemoryMessageSender, final String messageType) { return containsMessageOfType(inMemoryMessageSender.getSentMessages(), messageType); }  static boolean messageTypeSent(final InMemoryMessageSender<TypedMessage> inMemoryMessageSender,
            final String messageType); static boolean eventTypePublished(final InMemoryMessagePublisher<TypedMessage> inMemoryMessagePublisher,
            final Class<? extends Event> eventClass); static boolean eventPublished(final InMemoryMessagePublisher<TypedMessage> inMemoryMessagePublisher,
            final Event event); @SafeVarargs static List<Event> publishedEvents(final InMemoryMessagePublisher<TypedMessage> inMemoryMessagePublisher,
            final Class<? extends Event>... eventClasses);  }### Answer:
@Test public void shouldReturnTrueWhenMessageSent_onMessageTypeSent() { final InMemoryMessageSender<TypedMessage> mockInMemoryMessageSender = mock(InMemoryMessageSender.class); final List<TypedMessage> mockSentMessages = new ArrayList<>(); final TypedMessage mockSentMessage = mock(TypedMessage.class); final String sentMessageType = randomString(); when(mockSentMessage.getType()).thenReturn(sentMessageType); mockSentMessages.add(mockSentMessage); when(mockInMemoryMessageSender.getSentMessages()).thenReturn(mockSentMessages); final boolean messageTypeSent = InMemoryMessageVerifier.messageTypeSent(mockInMemoryMessageSender, sentMessageType); assertTrue(messageTypeSent); }
@Test public void shouldReturnFalseWhenMessageNotSent_onMessageTypeSent() { final InMemoryMessageSender<TypedMessage> mockInMemoryMessageSender = mock(InMemoryMessageSender.class); final List<TypedMessage> mockSentMessages = new ArrayList<>(); when(mockInMemoryMessageSender.getSentMessages()).thenReturn(mockSentMessages); final String messageType = randomString(); final boolean messageTypeSent = InMemoryMessageVerifier.messageTypeSent(mockInMemoryMessageSender, messageType); assertFalse(messageTypeSent); }