WorldpayPaymentInfoIsApmHandler implements DynamicAttributeHandler<Boolean, PaymentInfoModel> { @Override public Boolean get(final PaymentInfoModel model) { return getAllAPMCodes().contains(model.getPaymentType()); }  @Override Boolean get(final PaymentInfoModel model); @Override void set(final PaymentInfoModel model, final Boolean aBoolean); @Required void setApmConfigurationLookupService(final APMConfigurationLookupService apmConfigurationLookupService);  }
@Test public void testGetShouldReturnTrueWhenPaymentTypeIsAPM() throws Exception { when(apmConfigurationLookupServiceMock.getAllApmPaymentTypeCodes()).thenReturn(new HashSet<>(Arrays.asList(PAYMENT_1, PAYMENT_2))); when(paymentInfoModelMock.getPaymentType()).thenReturn(PAYMENT_1); final Boolean result = testObj.get(paymentInfoModelMock); assertTrue(result); }
@Test public void testGetShouldReturnFalseWhenPaymentTypeIsNotAPM() throws Exception { when(apmConfigurationLookupServiceMock.getAllApmPaymentTypeCodes()).thenReturn(new HashSet<>(Arrays.asList(PAYMENT_1, PAYMENT_2))); when(paymentInfoModelMock.getPaymentType()).thenReturn(NOT_APM); final Boolean result = testObj.get(paymentInfoModelMock); assertFalse(result); }