// Path: src/test/java/com/github/sbouclier/mock/MockHttpsURLConnection.java
// public class MockHttpsURLConnection extends HttpsURLConnection {
//     public MockHttpsURLConnection(URL url) {
//         super(url);
//     }
// 
//     @Override
//     public String getCipherSuite() {
//         return null;
//     }
// 
//     @Override
//     public Certificate[] getLocalCertificates() {
//         return new Certificate[0];
//     }
// 
//     @Override
//     public Certificate[] getServerCertificates() throws SSLPeerUnverifiedException {
//         return new Certificate[0];
//     }
// 
//     @Override
//     public void disconnect() {
// 
//     }
// 
//     @Override
//     public boolean usingProxy() {
//         return false;
//     }
// 
//     @Override
//     public void connect() throws IOException {
// 
//     }
// 
//     @Override
//     public OutputStream getOutputStream() throws IOException {
//         return new OutputStream() {
//             @Override
//             public void write(int b) throws IOException {
// 
//             }
//         };
//     }
// 
//     @Override
//     public InputStream getInputStream() throws IOException {
//         return new ByteArrayInputStream("read inputstream".getBytes("UTF-8"));
//     }
// }


import com.github.sbouclier.mock.MockHttpsURLConnection;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.mockito.ArgumentMatchers.any;
package com.github.sbouclier;




/**
 * HttpJsonClient test
 *
 * @author Stéphane Bouclier
 */
public class HttpJsonClientTest {

    @Test
    public void should_execute_public_query_without_params() throws IOException, KrakenApiException {

        // Given
        HttpJsonClient spyClient = Mockito.spy(HttpJsonClient.class);
        Mockito.doReturn("response").when(spyClient).getPublicJsonResponse(new URL("https://baseUrl/urlMethod?"));

        // When
        String result = spyClient.executePublicQuery("https://baseUrl", "/urlMethod");

        // Then
        assertThat(result, equalTo("response"));
    }

    @Test
    public void should_execute_public_query_with_params() throws IOException, KrakenApiException {

        // Given
        HttpJsonClient spyClient = Mockito.spy(HttpJsonClient.class);

        Map<String, String> params = new HashMap<>();
        params.put("a", "A");
        params.put("b", "B");
        params.put("c", "C");

        Mockito.doReturn("response").when(spyClient).getPublicJsonResponse(new URL("https://baseUrl/urlMethod?a=A&b=B&c=C&"));

        // When
        String result = spyClient.executePublicQuery("https://baseUrl", "/urlMethod", params);

        // Then
        assertThat(result, equalTo("response"));
    }

    @Test
    public void should_execute_public_query_with_empty_params() throws IOException, KrakenApiException {

        // Given
        HttpJsonClient spyClient = Mockito.spy(HttpJsonClient.class);
        Mockito.doReturn("response").when(spyClient).getPublicJsonResponse(new URL("https://baseUrl/urlMethod?"));

        // When
        String result = spyClient.executePublicQuery("https://baseUrl", "/urlMethod", new HashMap<>());

        // Then
        assertThat(result, equalTo("response"));
    }

    @Test
    public void should_retrieve_public_json_response() throws IOException, KrakenApiException {

        // Given
        URL url = null;
// Path: src/test/java/com/github/sbouclier/mock/MockHttpsURLConnection.java
// public class MockHttpsURLConnection extends HttpsURLConnection {
//     public MockHttpsURLConnection(URL url) {
//         super(url);
//     }
// 
//     @Override
//     public String getCipherSuite() {
//         return null;
//     }
// 
//     @Override
//     public Certificate[] getLocalCertificates() {
//         return new Certificate[0];
//     }
// 
//     @Override
//     public Certificate[] getServerCertificates() throws SSLPeerUnverifiedException {
//         return new Certificate[0];
//     }
// 
//     @Override
//     public void disconnect() {
// 
//     }
// 
//     @Override
//     public boolean usingProxy() {
//         return false;
//     }
// 
//     @Override
//     public void connect() throws IOException {
// 
//     }
// 
//     @Override
//     public OutputStream getOutputStream() throws IOException {
//         return new OutputStream() {
//             @Override
//             public void write(int b) throws IOException {
// 
//             }
//         };
//     }
// 
//     @Override
//     public InputStream getInputStream() throws IOException {
//         return new ByteArrayInputStream("read inputstream".getBytes("UTF-8"));
//     }
// }


// Path: src/test/java/com/github/sbouclier/HttpJsonClientTest.java
import com.github.sbouclier.mock.MockHttpsURLConnection;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.mockito.ArgumentMatchers.any;

package com.github.sbouclier;




/**
 * HttpJsonClient test
 *
 * @author Stéphane Bouclier
 */
public class HttpJsonClientTest {

    @Test
    public void should_execute_public_query_without_params() throws IOException, KrakenApiException {

        // Given
        HttpJsonClient spyClient = Mockito.spy(HttpJsonClient.class);
        Mockito.doReturn("response").when(spyClient).getPublicJsonResponse(new URL("https://baseUrl/urlMethod?"));

        // When
        String result = spyClient.executePublicQuery("https://baseUrl", "/urlMethod");

        // Then
        assertThat(result, equalTo("response"));
    }

    @Test
    public void should_execute_public_query_with_params() throws IOException, KrakenApiException {

        // Given
        HttpJsonClient spyClient = Mockito.spy(HttpJsonClient.class);

        Map<String, String> params = new HashMap<>();
        params.put("a", "A");
        params.put("b", "B");
        params.put("c", "C");

        Mockito.doReturn("response").when(spyClient).getPublicJsonResponse(new URL("https://baseUrl/urlMethod?a=A&b=B&c=C&"));

        // When
        String result = spyClient.executePublicQuery("https://baseUrl", "/urlMethod", params);

        // Then
        assertThat(result, equalTo("response"));
    }

    @Test
    public void should_execute_public_query_with_empty_params() throws IOException, KrakenApiException {

        // Given
        HttpJsonClient spyClient = Mockito.spy(HttpJsonClient.class);
        Mockito.doReturn("response").when(spyClient).getPublicJsonResponse(new URL("https://baseUrl/urlMethod?"));

        // When
        String result = spyClient.executePublicQuery("https://baseUrl", "/urlMethod", new HashMap<>());

        // Then
        assertThat(result, equalTo("response"));
    }

    @Test
    public void should_retrieve_public_json_response() throws IOException, KrakenApiException {

        // Given
        URL url = null;
        final MockHttpsURLConnection mockHttpURLConnection = new MockHttpsURLConnection(url);