DefaultOrderModificationDao extends AbstractItemDao implements OrderModificationDao { @Override public List<WorldpayOrderModificationModel> findProcessedOrderModificationsBeforeDate(final Date date) { validateParameterNotNull(date, "Date must not be null"); final FlexibleSearchQuery query = new FlexibleSearchQuery(ORDER_MODIFICATION_CLEAN_UP_QUERY); query.addQueryParameter(BEFORE_DATE, date); query.addQueryParameter(PROCESSED, true); query.addQueryParameter(DEFECTIVE, false); final SearchResult<WorldpayOrderModificationModel> result = search(query); return result.getResult(); }  @Override List<WorldpayOrderModificationModel> findUnprocessedOrderModificationsByType(final PaymentTransactionType paymentTransactionType); @Override List<WorldpayOrderModificationModel> findUnprocessedAndNotNotifiedOrderModificationsBeforeDate(final Date date); @Override List<WorldpayOrderModificationModel> findProcessedOrderModificationsBeforeDate(final Date date); @Override List<WorldpayOrderModificationModel> findExistingModifications(final WorldpayOrderModificationModel worldpayOrderModificationModel);  }
@Test public void testFindProcessedOrderModificationsBeforeDate() { final Date myDate = new Date(); final List<WorldpayOrderModificationModel> result = testObj.findProcessedOrderModificationsBeforeDate(myDate); assertTrue(result.size() == 1); assertSame(worldpayOrderModificationModelMock, result.get(0)); verify(flexibleSearchServiceMock).search(queryArgumentCaptor.capture()); final FlexibleSearchQuery queryArgumentCaptorValue = queryArgumentCaptor.getValue(); assertEquals(ORDER_MODIFICATION_CLEAN_UP_QUERY, queryArgumentCaptorValue.getQuery()); assertEquals(myDate, queryArgumentCaptorValue.getQueryParameters().get(BEFORE_DATE)); assertEquals(true, queryArgumentCaptorValue.getQueryParameters().get(PROCESSED)); assertEquals(false, queryArgumentCaptorValue.getQueryParameters().get(DEFECTIVE)); }