DefaultWorldpayCartDao extends AbstractItemDao implements WorldpayCartDao { @Override public CartModel findCartByWorldpayOrderCode(final String worldpayOrderCode) { final FlexibleSearchQuery fQuery = new FlexibleSearchQuery(QUERY); fQuery.addQueryParameters(Collections.singletonMap(PARAM_WORLD_PAY_ORDER_CODE, worldpayOrderCode)); fQuery.setResultClassList(Collections.singletonList(CartModel.class)); return searchUnique(fQuery); }  @Override CartModel findCartByWorldpayOrderCode(final String worldpayOrderCode);  }
@Test public void testGetCartsByWorldpayOrderCode() throws Exception { when(flexibleSearchServiceMock.searchUnique(queryArgumentCaptor.capture())).thenReturn(cartModelMock); final CartModel result = testObj.findCartByWorldpayOrderCode(ORDER_CODE); assertSame(cartModelMock, result); final FlexibleSearchQuery queryArgumentCaptorValue = queryArgumentCaptor.getValue(); assertEquals(QUERY, queryArgumentCaptorValue.getQuery()); assertEquals(ORDER_CODE, queryArgumentCaptorValue.getQueryParameters().get(PARAM_WORLD_PAY_ORDER_CODE)); }