|
| 1 | +/******************************************************************************* |
| 2 | + * Copyright (c) 2019 Intuit |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + *******************************************************************************/ |
| 16 | +package com.intuit.payment.services; |
| 17 | + |
| 18 | +import org.testng.annotations.Test; |
| 19 | + |
| 20 | +import com.intuit.payment.data.Card; |
| 21 | +import com.intuit.payment.data.Token; |
| 22 | +import com.intuit.payment.exception.BaseException; |
| 23 | + |
| 24 | +public class CardServiceTest { |
| 25 | + |
| 26 | + @Test(expectedExceptions = IllegalArgumentException.class) |
| 27 | + public void testcreateCustomerBlank() throws BaseException { |
| 28 | + CardService cardService = new CardService(); |
| 29 | + cardService.create(new Card(), ""); |
| 30 | + } |
| 31 | + |
| 32 | + @Test(expectedExceptions = IllegalArgumentException.class) |
| 33 | + public void testgetAllCardsCustomerBlank() throws BaseException { |
| 34 | + CardService cardService = new CardService(); |
| 35 | + cardService.getAllCards(""); |
| 36 | + } |
| 37 | + |
| 38 | + @Test(expectedExceptions = IllegalArgumentException.class) |
| 39 | + public void testgetAllCardsCustomerNull() throws BaseException { |
| 40 | + CardService cardService = new CardService(); |
| 41 | + cardService.getAllCards(null); |
| 42 | + } |
| 43 | + |
| 44 | + @Test(expectedExceptions = IllegalArgumentException.class) |
| 45 | + public void testgetAllCardCountCustomerBlank() throws BaseException { |
| 46 | + CardService cardService = new CardService(); |
| 47 | + cardService.getAllCards("", 0); |
| 48 | + } |
| 49 | + |
| 50 | + @Test(expectedExceptions = IllegalArgumentException.class) |
| 51 | + public void testgetAllCardCountCustomerNull() throws BaseException { |
| 52 | + CardService cardService = new CardService(); |
| 53 | + cardService.getAllCards(null, 0); |
| 54 | + } |
| 55 | + |
| 56 | + @Test(expectedExceptions = IllegalArgumentException.class) |
| 57 | + public void testcreateFromTokenCustomerBlank() throws BaseException { |
| 58 | + CardService cardService = new CardService(); |
| 59 | + cardService.createFromToken(new Token(), ""); |
| 60 | + } |
| 61 | + |
| 62 | + @Test(expectedExceptions = IllegalArgumentException.class) |
| 63 | + public void testdeleteCustomerBlank() throws BaseException { |
| 64 | + CardService cardService = new CardService(); |
| 65 | + cardService.delete("", ""); |
| 66 | + } |
| 67 | + |
| 68 | + @Test(expectedExceptions = IllegalArgumentException.class) |
| 69 | + public void testgetCardCustomerBlank() throws BaseException { |
| 70 | + CardService cardService = new CardService(); |
| 71 | + cardService.getCard("", "12345"); |
| 72 | + } |
| 73 | + |
| 74 | + @Test(expectedExceptions = IllegalArgumentException.class) |
| 75 | + public void testgetCardCardIdBlank() throws BaseException { |
| 76 | + CardService cardService = new CardService(); |
| 77 | + cardService.getCard("customerid", ""); |
| 78 | + } |
| 79 | +} |
0 commit comments