DefaultProcessDefinitionDao extends AbstractItemDao implements ProcessDefinitionDao { @Override public List<BusinessProcessModel> findWaitingOrderProcesses(final String orderCode, final PaymentTransactionType paymentTransactionType) { validateParameterNotNull(paymentTransactionType, "Transaction type must not be null"); validateParameterNotNull(orderCode, "Order code must not be null"); final FlexibleSearchQuery query = new FlexibleSearchQuery(GET_BUSINESS_PROCESS_QUERY); query.addQueryParameter(QUERY_PARAM_ACTION_TYPE, WAIT_ID_PREFIX + paymentTransactionType.getCode()); query.addQueryParameter(QUERY_PARAM_ORDER_CODE, orderCode); final SearchResult<BusinessProcessModel> searchResult = getFlexibleSearchService().search(query); return searchResult.getResult(); }  @Override List<BusinessProcessModel> findWaitingOrderProcesses(final String orderCode, final PaymentTransactionType paymentTransactionType);  }
@Test public void testFindWaitingProcessForTransactionType() throws Exception { final List<BusinessProcessModel> result = testObj.findWaitingOrderProcesses(ORDER_CODE, AUTHORIZATION); assertTrue(result.size() == 1); assertSame(businessProcessModelMock, result.get(0)); verify(flexibleSearchServiceMock).search(queryArgumentCaptor.capture()); final FlexibleSearchQuery queryArgumentCaptorValue = queryArgumentCaptor.getValue(); assertEquals(GET_BUSINESS_PROCESS_QUERY, queryArgumentCaptorValue.getQuery()); assertEquals(WAIT_ID_PREFIX + AUTHORIZATION.getCode(), queryArgumentCaptorValue.getQueryParameters().get(QUERY_PARAM_ACTION_TYPE)); assertEquals(ORDER_CODE, queryArgumentCaptorValue.getQueryParameters().get(QUERY_PARAM_ORDER_CODE)); }