@Test(groups = "fast") public void testUnknowns() throws Exception { Assert.assertNull(PaymentMethodUtils.getCardCountry(null)); Assert.assertNull(PaymentMethodUtils.getCardType(null)); Assert.assertNull(PaymentMethodUtils.getPaymentMethodType(null)); final PaymentMethodPlugin paymentMethodPlugin = Mockito.mock(PaymentMethodPlugin.class); Assert.assertNull(PaymentMethodUtils.getCardCountry(paymentMethodPlugin)); Assert.assertNull(PaymentMethodUtils.getCardType(paymentMethodPlugin)); Assert.assertNull(PaymentMethodUtils.getPaymentMethodType(paymentMethodPlugin)); }
@Test(groups = "fast") public void testCardCountry() throws Exception { final String country = UUID.randomUUID().toString(); final String cardType = UUID.randomUUID().toString(); final String type = UUID.randomUUID().toString(); final PaymentMethodPlugin paymentMethodPlugin = Mockito.mock(PaymentMethodPlugin.class); Mockito.when(paymentMethodPlugin.getValueString(PaymentMethodUtils.COUNTRY_KEY)) .thenReturn(country); Mockito.when(paymentMethodPlugin.getValueString(PaymentMethodUtils.CARD_TYPE_KEY)) .thenReturn(cardType); Mockito.when(paymentMethodPlugin.getValueString(PaymentMethodUtils.TYPE_KEY)).thenReturn(type); Assert.assertEquals(PaymentMethodUtils.getCardCountry(paymentMethodPlugin), country); Assert.assertEquals(PaymentMethodUtils.getCardType(paymentMethodPlugin), cardType); Assert.assertEquals(PaymentMethodUtils.getPaymentMethodType(paymentMethodPlugin), type); }