@Test
  public void shouldCreateReusableTokenForVisa() {
    CardRequest cardRequest = new CardRequest();
    cardRequest.setName("John Doe");
    cardRequest.setCardNumber("4444333322221111");
    cardRequest.setExpiryMonth(2);
    cardRequest.setExpiryYear(EXPIRY_YEAR);
    cardRequest.setCvc("123");

    CommonToken commonToken = new CommonToken(cardRequest, true);

    TokenRequest tokenRequest = new TokenRequest(commonToken);
    tokenRequest.setClientKey(PropertyUtils.getProperty("clientKey"));

    when().weCreateAToken(tokenRequest);

    then()
        .theTokenStartsWith("TEST_RU_")
        .and()
        .theCardTypeIs("VISA_CREDIT")
        .and()
        .theMaskedCardNumberIs("**** **** **** 1111")
        .and()
        .theCardSchemaTypeIs("consumer")
        .and()
        .theCardSchemaNameIs("VISA CREDIT")
        .and()
        .theCardIssuerIs("NATWEST")
        .and()
        .theCountryCodeIs("GB")
        .and()
        .theCardClassIs("credit")
        .and()
        .theCardProductTypeDescNonContactless("Visa Credit Personal")
        .and()
        .theCardProductTypeDescContactless("CL Visa Credit Pers")
        .and()
        .thePrepaidIs("false")
        .and()
        .theExpiryMonthIs(2)
        .and()
        .theExpiryYearIs(EXPIRY_YEAR)
        .and()
        .theIssuerNumberIsNull()
        .and()
        .theStartMonthIsNull()
        .and()
        .theStartYearIsNull()
        .and()
        .theNameIs("John Doe")
        .and()
        .theTokenIsReusable()
        .and()
        .theShopperLanguageCodeIsNull()
        .and()
        .theBillingAddressIsNull();
  }
  @Test
  public void shouldCreateSingleUseTokenForMaestro() {
    CardRequest cardRequest = new CardRequest();
    cardRequest.setName("John Doe");
    cardRequest.setCardNumber("6759649826438453");
    cardRequest.setExpiryMonth(2);
    cardRequest.setExpiryYear(EXPIRY_YEAR);
    cardRequest.setCvc("123");

    CommonToken commonToken = new CommonToken(cardRequest, false);

    TokenRequest tokenRequest = new TokenRequest(commonToken);
    tokenRequest.setClientKey(PropertyUtils.getProperty("clientKey"));

    when().weCreateAToken(tokenRequest);

    then()
        .theTokenStartsWith("TEST_SU_")
        .and()
        .theCardTypeIs("MAESTRO")
        .and()
        .theMaskedCardNumberIs("**** **** **** 8453")
        .and()
        .theCardSchemaTypeIs("unknown")
        .and()
        .theCardSchemaNameIs("unknown")
        .and()
        .theCardIssuerIs("unknown")
        .and()
        .theCountryCodeIs("XX")
        .and()
        .theCardClassIs("unknown")
        .and()
        .theCardProductTypeDescNonContactless("unknown")
        .and()
        .theCardProductTypeDescContactless("unknown")
        .and()
        .thePrepaidIs("unknown")
        .and()
        .theExpiryMonthIs(2)
        .and()
        .theExpiryYearIs(EXPIRY_YEAR)
        .and()
        .theIssuerNumberIsNull()
        .and()
        .theStartMonthIsNull()
        .and()
        .theStartYearIsNull()
        .and()
        .theNameIs("John Doe")
        .and()
        .theTokenIsNotReusable()
        .and()
        .theShopperLanguageCodeIsNull()
        .and()
        .theBillingAddressIsNull();
  }
  @Test
  public void shouldThrowExceptionIfTokenCreationRequestIsInvalid() {
    CardRequest cardRequest = new CardRequest();
    cardRequest.setName("John Doe");
    cardRequest.setCardNumber("6759649826438453");
    cardRequest.setExpiryMonth(2);
    cardRequest.setExpiryYear(EXPIRY_YEAR);
    cardRequest.setCvc("bad-cvc");

    CommonToken commonToken = new CommonToken(cardRequest, false);

    TokenRequest tokenRequest = new TokenRequest(commonToken);
    tokenRequest.setClientKey(PropertyUtils.getProperty("clientKey"));

    when().weCreateAToken(tokenRequest);

    then()
        .theApiErrorCustomCodeIs("BAD_REQUEST")
        .theErrorMessageIs("API error: CVC Must always contain valid digits");
  }