@Test( groups = "integration", dependsOnMethods = {"testUpdateCreditCard"}) public void deleteCreditCard() throws PayPalRESTException { logger.info("**** Delete CreditCard ****"); logger.info("Generated Access Token = " + TokenHolder.accessToken); CreditCard retrievedCreditCard = CreditCard.get(TokenHolder.accessToken, createdCreditCardId); retrievedCreditCard.delete(TokenHolder.accessToken); logger.info("Request = " + CreditCard.getLastRequest()); logger.info("Response = " + CreditCard.getLastResponse()); try { CreditCard.get(TokenHolder.accessToken, createdCreditCardId); } catch (Exception e) { e.printStackTrace(); } }
@Test( groups = "integration", dependsOnMethods = {"createCreditCardTest"}) public void testGetCreditCard() throws PayPalRESTException { logger.info("**** Get CreditCard ****"); logger.info("Generated Access Token = " + TokenHolder.accessToken); CreditCard retrievedCreditCard = CreditCard.get(TokenHolder.accessToken, createdCreditCardId); logger.info("Request = " + CreditCard.getLastRequest()); logger.info("Response = " + CreditCard.getLastResponse()); Assert.assertEquals( true, this.creditCard.getId().equalsIgnoreCase(retrievedCreditCard.getId())); logger.info("Retrieved Credit Card status = " + retrievedCreditCard.getState()); }
@Test( groups = "integration", dependsOnMethods = {"testGetCreditCard"}) public void getCreditCardForNull() { logger.info("**** Get CreditCard Null ****"); logger.info("Generated Access Token = " + TokenHolder.accessToken); try { CreditCard.get(TokenHolder.accessToken, null); } catch (IllegalArgumentException e) { Assert.assertTrue(e != null, "Illegal Argument Exception not thrown for null arguments"); } catch (PayPalRESTException e) { Assert.fail(); } }