/** Test factory for payment token. */ @Test public void testFactoryForPaymentToken() { PaymentMethod paymentMethod = new PaymentTokenImpl.TokenBuilder().build(); PaymentMethodTransformer transformer = paymentMethodTransformerFactory.getTransformerInstance(paymentMethod); assertNotNull(transformer); }
/** Test factory for customer credit card. */ @Test public void testFactoryForCustomerCreditCard() { PaymentMethod paymentMethod = new CustomerCreditCardImpl(); PaymentMethodTransformer transformer = paymentMethodTransformerFactory.getTransformerInstance(paymentMethod); assertNotNull(transformer); }
/** Test factory for non existent payment method. */ @Test public void testFactoryForNonExistentPaymentMethod() { PaymentMethod paymentMethod = new UnimplementedPaymentMethod(); exception.expect(IllegalArgumentException.class); exception.expectMessage("UnimplementedPaymentMethod"); exception.expectMessage("No transformer found"); paymentMethodTransformerFactory.getTransformerInstance(paymentMethod); }