Search in sources :

Example 6 with Card

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);
}
Also used : DateTime(org.joda.time.DateTime) Card(model.banking.Card) Test(org.junit.Test)

Aggregations

Card (model.banking.Card)6 PlainTextOutputSpeech (com.amazon.speech.ui.PlainTextOutputSpeech)2 Reprompt (com.amazon.speech.ui.Reprompt)2 ArrayList (java.util.ArrayList)2 DateTime (org.joda.time.DateTime)2 Test (org.junit.Test)2 SsmlOutputSpeech (com.amazon.speech.ui.SsmlOutputSpeech)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 List (java.util.List)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 ParameterizedTypeReference (org.springframework.core.ParameterizedTypeReference)1 Resources (org.springframework.hateoas.Resources)1 Traverson (org.springframework.hateoas.client.Traverson)1