### Question:
InMemoryMockDocumentSearchEngine extends InMemoryDocumentSearchEngine implements Resettable { public boolean contains(final Document document) { return allDocuments.contains(document); } InMemoryMockDocumentSearchEngine(); boolean contains(final Document document); boolean containsExactly(final Collection<Document> documents); @SuppressWarnings("unchecked") @Override DocumentSearchResponse<T> search(final Query query, final Integer start,
            final Integer size, final Class<T> documentClass, final SearchOptions searchOptions); SearchExpectation when(final Query query, final Integer start, final Integer size,
            final Class<? extends Document> documentClass, final SearchOptions searchOptions); @Override void reset();  }### Answer:
@Test public void shouldUpdateDocument_withDocument() throws Exception { final Document document = mock(Document.class); final InMemoryMockDocumentSearchEngine documentSearchEngine = new InMemoryMockDocumentSearchEngine(); documentSearchEngine.update(document); assertTrue(documentSearchEngine.contains(document)); }
@Test public void shouldDeleteDocument_withDocument() throws Exception { final Document document = mock(Document.class); final InMemoryMockDocumentSearchEngine documentSearchEngine = new InMemoryMockDocumentSearchEngine(); documentSearchEngine.update(document); assertTrue(documentSearchEngine.contains(document)); documentSearchEngine.delete(document); assertFalse(documentSearchEngine.contains(document)); }
@Test public void shouldDelete_withDocuments() throws Exception { final Collection<Document> documents = Arrays.asList(mock(Document.class), mock(Document.class), mock(Document.class)); final InMemoryMockDocumentSearchEngine documentSearchEngine = new InMemoryMockDocumentSearchEngine(); for (final Document document : documents) { documentSearchEngine.update(document); assertTrue(documentSearchEngine.contains(document)); } documentSearchEngine.delete(documents); for (final Document document : documents) { assertFalse(documentSearchEngine.contains(document)); } }
@Test public void shouldVerifyContains_withSingleDocument() throws Exception { final Document document = mock(Document.class); final InMemoryMockDocumentSearchEngine documentSearchEngine = new InMemoryMockDocumentSearchEngine(); documentSearchEngine.update(document); final boolean containsDocuments = documentSearchEngine.contains(document); assertTrue(containsDocuments); }