WorldpayOrderDataPopulator implements Populator<OrderModel, OrderData> { @Override public void populate(final OrderModel source, final OrderData target) throws ConversionException { target.setIsApmOpen(worldpayPaymentTransactionService.isAnyPaymentTransactionApmOpenForOrder(source)); }  @Override void populate(final OrderModel source, final OrderData target); @Required void setWorldpayPaymentTransactionService(final WorldpayPaymentTransactionService worldpayPaymentTransactionService);  }
@Test public void populateShouldSetPaymentPendingConfirmationTrueWhenPaymentTransactionIsMarkedAsAPMOpen() throws Exception { when(paymentTransactionServiceMock.isAnyPaymentTransactionApmOpenForOrder(abstractOrderModelMock)).thenReturn(true); testObj.populate(abstractOrderModelMock, orderDataMock); verify(orderDataMock).setIsApmOpen(true); }
@Test public void populateShouldSetPaymentPendingConfirmationFalseWhenPaymentTransactionIsNotMarkedAsAPMOpen() throws Exception { when(paymentTransactionServiceMock.isAnyPaymentTransactionApmOpenForOrder(abstractOrderModelMock)).thenReturn(false); testObj.populate(abstractOrderModelMock, orderDataMock); verify(orderDataMock).setIsApmOpen(false); }