VisitorDataQueue extends VisitorDataHandler { @Override public void onMessage(Message m, AckToken token) { if (m instanceof PutDocumentMessage) { appendSingleOpToPendingList(((PutDocumentMessage)m).getDocumentPut(), token); } else if (m instanceof RemoveDocumentMessage) { appendSingleOpToPendingList(((RemoveDocumentMessage)m).getDocumentRemove(), token); } else { throw new UnsupportedOperationException( String.format("Expected put/remove message, got '%s' of type %s", m.toString(), m.getClass().toString())); } } VisitorDataQueue(); @Override void reset(); @Override void onMessage(Message m, AckToken token); @Override VisitorResponse getNext(); @Override VisitorResponse getNext(int timeoutMilliseconds);  }
@Test(expected = UnsupportedOperationException.class) public void unknown_message_throws_unsupported_operation_exception() { final VisitorDataQueue queue = new VisitorDataQueue(); queue.onMessage(new GetDocumentMessage(new DocumentId("id:foo:testdoc::bar")), createDummyAckToken()); }