// Path: src/main/java/com/hyperwallet/clientsdk/HyperwalletException.java
// public class HyperwalletException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private Response response = null;
//     private String errorMessage;
//     private String errorCode;
//     private List<String> relatedResources;
//     private HyperwalletErrorList hyperwalletErrorList;
// 
//     public HyperwalletException(final Exception e) {
//         super(e);
//     }
// 
//     public HyperwalletException(final Response response, final int code, final String message) {
//         super(message);
// 
//         this.response = response;
//         errorCode = Integer.toString(code);
//         errorMessage = message;
//     }
// 
//     public HyperwalletException(final Response response, final int code, final String message, final Exception e) {
//         super(e);
// 
//         this.response = response;
//         errorCode = Integer.toString(code);
//         errorMessage = message;
//     }
// 
//     public HyperwalletException(final Response response, final HyperwalletErrorList hyperwalletErrorList) {
//         super(hyperwalletErrorList.getErrors().get(0).getMessage());
// 
//         this.response = response;
//         this.hyperwalletErrorList = hyperwalletErrorList;
//         HyperwalletError error = this.hyperwalletErrorList.getErrors().get(0);
//         errorCode = error.getCode();
//         errorMessage = error.getMessage();
//         relatedResources = error.getRelatedResources();
//     }
// 
//     public HyperwalletException(final String errorMessage) {
//         super(errorMessage);
// 
//         this.errorMessage = errorMessage;
//     }
// 
//     public Response getResponse() {
//         return response;
//     }
// 
//     public String getErrorMessage() {
//         return errorMessage;
//     }
// 
//     public String getErrorCode() {
//         return errorCode;
//     }
// 
//     public List<String> getRelatedResources() {
//         return relatedResources;
//     }
// 
//     public List<HyperwalletError> getHyperwalletErrors() {
//         return hyperwalletErrorList != null ? hyperwalletErrorList.getErrors() : null;
//     }
// }


import com.hyperwallet.clientsdk.HyperwalletException;
import com.nimbusds.jose.EncryptionMethod;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JWEAlgorithm;
import com.nimbusds.jose.JWSAlgorithm;
import org.apache.commons.io.IOUtils;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URISyntaxException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.testng.Assert.fail;
    public void shouldThrowExceptionWhenKeySetFileIsNotFound()
            throws URISyntaxException, IOException, ParseException, JOSEException {
        ClassLoader classLoader = getClass().getClassLoader();
        String hyperwalletKeysPath = new File(classLoader.getResource("encryption/public-jwkset").toURI()).getAbsolutePath();
        String clientPrivateKeysPath = "/encryption/public-jwkset/keyset.json";
        String testPayload = IOUtils.toString(classLoader.getResourceAsStream("encryption/test-payload.json"));

        HyperwalletEncryption hyperwalletEncryption = new HyperwalletEncryption.HyperwalletEncryptionBuilder()
                .clientPrivateKeySetLocation(clientPrivateKeysPath).hyperwalletKeySetLocation(hyperwalletKeysPath).build();

        try {
            hyperwalletEncryption.encrypt(testPayload);
            fail("Expected IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            assertThat(e.getMessage(), is(containsString("Wrong client JWK set location")));
        }
    }

    @Test
    public void shouldThrowExceptionWhenJWSSignatureExpirationDateIsNull() throws URISyntaxException {
        ClassLoader classLoader = getClass().getClassLoader();
        String hyperwalletKeysPath = new File(classLoader.getResource("encryption/public-jwkset").toURI()).getAbsolutePath();
        String clientPrivateKeysPath = new File(classLoader.getResource("encryption/private-jwkset").toURI()).getAbsolutePath();

        HyperwalletEncryption hyperwalletEncryption = new HyperwalletEncryption.HyperwalletEncryptionBuilder()
                .clientPrivateKeySetLocation(clientPrivateKeysPath).hyperwalletKeySetLocation(hyperwalletKeysPath).build();

        try {
            hyperwalletEncryption.verifySignatureExpirationDate(null);
            fail("Expected HyperwalletException");
// Path: src/main/java/com/hyperwallet/clientsdk/HyperwalletException.java
// public class HyperwalletException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private Response response = null;
//     private String errorMessage;
//     private String errorCode;
//     private List<String> relatedResources;
//     private HyperwalletErrorList hyperwalletErrorList;
// 
//     public HyperwalletException(final Exception e) {
//         super(e);
//     }
// 
//     public HyperwalletException(final Response response, final int code, final String message) {
//         super(message);
// 
//         this.response = response;
//         errorCode = Integer.toString(code);
//         errorMessage = message;
//     }
// 
//     public HyperwalletException(final Response response, final int code, final String message, final Exception e) {
//         super(e);
// 
//         this.response = response;
//         errorCode = Integer.toString(code);
//         errorMessage = message;
//     }
// 
//     public HyperwalletException(final Response response, final HyperwalletErrorList hyperwalletErrorList) {
//         super(hyperwalletErrorList.getErrors().get(0).getMessage());
// 
//         this.response = response;
//         this.hyperwalletErrorList = hyperwalletErrorList;
//         HyperwalletError error = this.hyperwalletErrorList.getErrors().get(0);
//         errorCode = error.getCode();
//         errorMessage = error.getMessage();
//         relatedResources = error.getRelatedResources();
//     }
// 
//     public HyperwalletException(final String errorMessage) {
//         super(errorMessage);
// 
//         this.errorMessage = errorMessage;
//     }
// 
//     public Response getResponse() {
//         return response;
//     }
// 
//     public String getErrorMessage() {
//         return errorMessage;
//     }
// 
//     public String getErrorCode() {
//         return errorCode;
//     }
// 
//     public List<String> getRelatedResources() {
//         return relatedResources;
//     }
// 
//     public List<HyperwalletError> getHyperwalletErrors() {
//         return hyperwalletErrorList != null ? hyperwalletErrorList.getErrors() : null;
//     }
// }


// Path: src/test/java/com/hyperwallet/clientsdk/util/HyperwalletEncryptionTest.java
import com.hyperwallet.clientsdk.HyperwalletException;
import com.nimbusds.jose.EncryptionMethod;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JWEAlgorithm;
import com.nimbusds.jose.JWSAlgorithm;
import org.apache.commons.io.IOUtils;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URISyntaxException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.testng.Assert.fail;

    public void shouldThrowExceptionWhenKeySetFileIsNotFound()
            throws URISyntaxException, IOException, ParseException, JOSEException {
        ClassLoader classLoader = getClass().getClassLoader();
        String hyperwalletKeysPath = new File(classLoader.getResource("encryption/public-jwkset").toURI()).getAbsolutePath();
        String clientPrivateKeysPath = "/encryption/public-jwkset/keyset.json";
        String testPayload = IOUtils.toString(classLoader.getResourceAsStream("encryption/test-payload.json"));

        HyperwalletEncryption hyperwalletEncryption = new HyperwalletEncryption.HyperwalletEncryptionBuilder()
                .clientPrivateKeySetLocation(clientPrivateKeysPath).hyperwalletKeySetLocation(hyperwalletKeysPath).build();

        try {
            hyperwalletEncryption.encrypt(testPayload);
            fail("Expected IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            assertThat(e.getMessage(), is(containsString("Wrong client JWK set location")));
        }
    }

    @Test
    public void shouldThrowExceptionWhenJWSSignatureExpirationDateIsNull() throws URISyntaxException {
        ClassLoader classLoader = getClass().getClassLoader();
        String hyperwalletKeysPath = new File(classLoader.getResource("encryption/public-jwkset").toURI()).getAbsolutePath();
        String clientPrivateKeysPath = new File(classLoader.getResource("encryption/private-jwkset").toURI()).getAbsolutePath();

        HyperwalletEncryption hyperwalletEncryption = new HyperwalletEncryption.HyperwalletEncryptionBuilder()
                .clientPrivateKeySetLocation(clientPrivateKeysPath).hyperwalletKeySetLocation(hyperwalletKeysPath).build();

        try {
            hyperwalletEncryption.verifySignatureExpirationDate(null);
            fail("Expected HyperwalletException");
        } catch (HyperwalletException e) {