@Test(groups = "unit") public void testConstruction() { CreditCard creditCard = createDummyCreditCard(); Assert.assertEquals(creditCard.getCvv2(), CVV2); Assert.assertEquals(creditCard.getExpireMonth(), EXPMONTH); Assert.assertEquals(creditCard.getExpireYear(), EXPYEAR); Assert.assertEquals(creditCard.getFirstName(), FIRSTNAME); Assert.assertEquals(creditCard.getLastName(), LASTNAME); Assert.assertEquals(creditCard.getNumber(), NUMBER); Assert.assertEquals(creditCard.getType(), TYPE); Assert.assertEquals(creditCard.getBillingAddress().getCity(), AddressTestCase.CITY); Assert.assertEquals(creditCard.getId(), ID); Assert.assertEquals(creditCard.getExternalCustomerId(), EXTERNAL_CUSTOMER_ID); Assert.assertEquals(creditCard.getState(), STATE); Assert.assertEquals(creditCard.getValidUntil(), VALIDUNTIL); Assert.assertEquals(creditCard.getLinks().size(), 1); }
@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()); }