@Test(
      groups = "integration",
      dependsOnMethods = {"createCreditCardTest"})
  public void testListCreditCard() throws PayPalRESTException {
    logger.info("**** List CreditCard ****");
    logger.info("Generated Access Token = " + TokenHolder.accessToken);

    CreditCardHistory creditCards = CreditCard.list(TokenHolder.accessToken);
    logger.info("Request = " + CreditCard.getLastRequest());
    logger.info("Response = " + CreditCard.getLastResponse());
    logger.info("Retrieved list of credit cards = " + creditCards.getItems());
    Assert.assertTrue(creditCards.getTotalItems() > 0);
  }
  @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 = {"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")
  public void createCreditCardTest() throws PayPalRESTException {
    logger.info("**** Create CreditCard ****");
    logger.info("Generated Access Token = " + TokenHolder.accessToken);

    CreditCard creditCard = new CreditCard();
    creditCard.setExpireMonth(EXPMONTH);
    creditCard.setExpireYear(EXPYEAR);
    creditCard.setNumber(NUMBER);
    creditCard.setType(TYPE);
    this.creditCard = creditCard.create(TokenHolder.accessToken);
    logger.info("Request = " + CreditCard.getLastRequest());
    logger.info("Response = " + CreditCard.getLastResponse());
    logger.info("Credit Card created with ID = " + this.creditCard.getId());
    Assert.assertEquals(true, "ok".equalsIgnoreCase(this.creditCard.getState()));
    logger.info("Created Credit Card status = " + this.creditCard.getState());
    createdCreditCardId = this.creditCard.getId();
  }
  @Test(
      groups = "integration",
      dependsOnMethods = {"testGetCreditCard"})
  public void testUpdateCreditCard() throws PayPalRESTException {
    logger.info("**** Update CreditCard ****");
    logger.info("Generated Access Token = " + TokenHolder.accessToken);

    // set up patch request
    Patch patch = new Patch();
    patch.setOp("replace");
    patch.setPath("/expire_year");
    patch.setValue(new Integer(2020));
    List<Patch> patchRequest = new ArrayList<Patch>();
    patchRequest.add(patch);

    // send patch request
    CreditCard creditCard = new CreditCard();
    creditCard.setId(createdCreditCardId);
    CreditCard retrievedCreditCard = creditCard.update(TokenHolder.accessToken, patchRequest);

    logger.info("Request = " + CreditCard.getLastRequest());
    logger.info("Response = " + CreditCard.getLastResponse());
    Assert.assertEquals(2020, retrievedCreditCard.getExpireYear());
  }