use of model.banking.Card in project amos-ss17-alexa by c-i-ber.
the class AccountTest method testCreateAndGetCard.
@Test
public void testCreateAndGetCard() {
Card card = new Card();
card.setCardType(Card.CardType.DEBIT);
card.setCardNumber(CARD_NUMBER);
card.setStatus(Card.Status.ACTIVE);
card.setExpirationDate(new DateTime(2018, 5, 1, 12, 0).toLocalDate().toString());
card.setAccountNumber(ACCOUNT_NUMBER);
Card newCard = AccountAPI.createCardForAccount(ACCOUNT_NUMBER, card);
assertEquals(card.getCardType(), newCard.getCardType());
assertEquals(card.getCardNumber(), newCard.getCardNumber());
assertEquals(card.getStatus(), newCard.getStatus());
assertEquals(card.getExpirationDate(), newCard.getExpirationDate());
// Get cards
Collection<Card> cards = AccountAPI.getCardsForAccount(ACCOUNT_NUMBER);
boolean foundCard = false;
for (Card card1 : cards) {
if (card1.getCardNumber().equals(newCard.getCardNumber())) {
foundCard = true;
}
AccountAPI.deleteCard(ACCOUNT_NUMBER, card1.getCardId());
}
assertTrue(foundCard);
}
Aggregations