package com.razorpay;

import org.junit.Test;
import org.mockito.InjectMocks;

import java.io.IOException;
import java.util.List;

import static org.junit.Assert.*;

public class CardClientTest extends BaseTest{

    @InjectMocks
    protected CardClient cardClientClient = new CardClient(TEST_SECRET_KEY);

    private static final String CARD_ID = "card_DZon6fd8J3IcA2";

    private static final String PAYMENT_ID = "pay_IDRP0tbirMSsbn";

    /** Fetch card details
     * @throws RazorpayException
     */
    @Test
    public void fetch() throws RazorpayException {

        String mockedResponseJson = "{\n  \"id\": "+CARD_ID+",\n  \"entity\": \"card\",\n  \"international\": false,\n  \"last4\": 1111,\n  \"name\": \"sample name\",\n  \"network\": \"Visa\",\n  \"type\": \"debit\"\n}";
        try {
            mockResponseFromExternalClient(mockedResponseJson);
            mockResponseHTTPCodeFromExternalClient(200);
            Card fetch = cardClientClient.fetch(CARD_ID);
            assertNotNull(fetch);
            assertEquals(CARD_ID,fetch.get("id"));
            assertTrue(fetch.has("international"));
        } catch (IOException e) {
            e.printStackTrace();
            assertTrue(false);
        }
    }

    /** Fetch Card Details of a Payment
     * @throws RazorpayException
     */
    @Test
    public void fetchCardDetails() throws RazorpayException {

        String mockedResponseJson = "{\"id\":"+CARD_ID+",\"entity\":\"card\",\"name\":\"GauravKumar\",\"last4\":\"8430\",\"network\":\"Visa\",\"type\":\"credit\",\"issuer\":\"HDFC\",\"international\":false,\"emi\":true,\"sub_type\":\"consumer\",\"token_iin\":null}";
        try {
            mockResponseFromExternalClient(mockedResponseJson);
            mockResponseHTTPCodeFromExternalClient(200);
            Card fetch = cardClientClient.fetchCardDetails(PAYMENT_ID);
            assertNotNull(fetch);
            assertEquals(CARD_ID,fetch.get("id"));
            assertTrue(fetch.has("name"));
            assertTrue(fetch.has("network"));
        } catch (IOException e) {
            e.printStackTrace();
            assertTrue(false);
        }
    }
}
@@ -447,26 +447,56 @@
 /** 
-Fetch card details
+Retrieving a specific card details using card id
 %0A   
@@ -1184,41 +1184,8 @@
 ) %7B%0A
-            e.printStackTrace();%0A
     
@@ -1246,14 +1246,13 @@
 tch 
-Card D
+the d
 etai
@@ -1261,11 +1261,33 @@
  of 
-a P
+the card used to make a p
 ayme
@@ -1314,32 +1314,52 @@
 zorpayException%0A
+     * @return void%0A
      */%0A    @Tes
@@ -2067,24 +2067,24 @@
 network%22));%0A
+
         %7D ca
@@ -2109,41 +2109,8 @@
 ) %7B%0A
-            e.printStackTrace();%0A
     

remove printstacktrack