RedirectAuthoriseResultPopulator implements Populator<Map<String, String>, RedirectAuthoriseResult> { @Override public void populate(final Map<String, String> source, final RedirectAuthoriseResult target) throws ConversionException { validateParameterNotNull(source, "Parameter source (Map<String, String>) cannot be null"); validateParameterNotNull(target, "Parameter target (RedirectAuthoriseResult) cannot be null"); final String orderKey = source.get("orderKey"); target.setOrderKey(orderKey); setOrderCode(target, orderKey); target.setPending(false); setPaymentStatus(source, target); target.setSaveCard(Boolean.valueOf(source.get(SAVE_PAYMENT_INFO))); target.setPaymentAmount(getPaymentAmount(source)); }  @Override void populate(final Map<String, String> source, final RedirectAuthoriseResult target); void setWorldpayOrderService(final WorldpayOrderService worldpayOrderService);  }
@Test public void shouldPopulateRedirectResultForStatusParameter() { populateParametersMap(); final RedirectAuthoriseResult result = new RedirectAuthoriseResult(); testObj.populate(statusSourceMap, result); assertEquals(ORDER_KEY, result.getOrderKey()); assertEquals(ORDER_CODE, result.getOrderCode()); assertEquals(AuthorisedStatus.AUTHORISED, result.getPaymentStatus()); assertEquals(false, result.getSaveCard()); assertEquals(false, result.getPending()); }