### Question:
MessageDispatcher { public void handle(String messageId, JsonValue content) throws NotFoundException, PredicateNotMetException { Reject.ifNull(content); Reject.ifNull(messageId); MessagePromise messagePromise = cache.getIfPresent(messageId); if (messagePromise != null) { for (Predicate p : messagePromise.getPredicates()) { if (!p.perform(content)) { throw new PredicateNotMetException("Predicate was not matched. Message invalid."); } } messagePromise.getPromise().tryHandleResult(content); cache.invalidate(messageId); } else { debug.warning("Cache was asked to handle {} but never expected it.", messageId); throw new NotFoundException("This cache was not primed for this messageId."); } } @Inject  MessageDispatcher(Cache<String, MessagePromise> dispatch, @Named("frPush") Debug debug); void handle(String messageId, JsonValue content); MessagePromise expect(String messageId, Set<Predicate> predicates); boolean forget(String messageId);  }### Answer:
@Test(expectedExceptions = NotFoundException.class) public void shouldErrorForHandleMessageIdWhenNotExpected() throws NotFoundException, PredicateNotMetException { messageDispatcher.handle("notexpected", json(object())); }