### Question:
DeltaJournal implements InitializingBean { public void journalPurge(long timeOfPurge) { String id = uuidGeneratorStrategy.generateId(); Update update = new Update(); update.set("t", timeOfPurge); update.set("c", PURGE); TenantContext.setIsSystemCall(false); template.upsert(Query.query(where("_id").is(id)), update, DELTA_COLLECTION); }  @Override void afterPropertiesSet(); void journal(Collection<String> ids, String collection, boolean isDelete); static List<byte[]> getByteId(String id); static String getEntityId(Map<String, Object> deltaRecord); void journal(String id, String collection, boolean isDelete); void journalCollapsedSubDocs(Collection<String> ids, String collection); void journalPurge(long timeOfPurge); Iterator<Map<String, Object>> findDeltaRecordBetween(final long start, final long end); void removeDeltaJournals(String tenant, long cleanUptoTime); static final String DELTA_COLLECTION; static final String PURGE; }### Answer:
@Test public void testJournalPurge() { final long time = new Date().getTime(); deltaJournal.journalPurge(time); BaseMatcher<Update> updateMatcher = new BaseMatcher<Update>() { @Override public boolean matches(Object arg0) { @SuppressWarnings("unchecked") Map<String, Object> o = (Map<String, Object>) ((Update) arg0).getUpdateObject().get("$set"); if (o.get("c").equals("purge") && o.get("t").equals(time)) { return true; } return false; } @Override public void describeTo(Description arg0) { arg0.appendText("Update with 'c' set to 'purge' and 't' set to time of purge"); } }; verify(template, Mockito.times(1)).upsert(Mockito.any(Query.class), argThat(updateMatcher), Mockito.eq("deltas")); }