// Path: src/main/java/com/easypost/exception/EasyPostException.java
// public class EasyPostException extends Exception {
// 
//     private static final long serialVersionUID = 1L;
//     private final String param;
// 
//     /**
//      * Constructor.
//      *
//      * @param message the exception message
//      */
//     public EasyPostException(final String message) {
//         super(message, null);
//         this.param = null;
//     }
// 
//     /**
//      * Constructor.
//      *
//      * @param message the exception message
//      * @param ex      the exception cause
//      */
//     public EasyPostException(final String message, final Throwable ex) {
//         super(message, ex);
//         this.param = null;
//     }
// 
//     /**
//      * Constructor.
//      *
//      * @param message the exception message
//      * @param param   the parameter name
//      * @param ex      the exception cause
//      */
//     public EasyPostException(final String message, final String param, final Throwable ex) {
//         super(message, ex);
//         this.param = param;
//     }
// 
//     /**
//      * Get the parameter name.
//      *
//      * @return the parameter name
//      */
//     public String getParam() {
//         return param;
//     }
// }


import com.easypost.model.*;
import java.util.HashMap;
import java.util.Map;
import com.easypost.exception.EasyPostException;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeAll;
import static org.junit.jupiter.api.Assertions.*;
package com.easypost;





public class UserTest {
    private static User globalUser;

    /**
     * Setup the testing environment for this file.
     *
     * @throws EasyPostException when the request fails.
     */
    @BeforeAll
    public static void setUp() throws EasyPostException{
        EasyPost.apiKey = System.getenv("EASYPOST_PROD_API_KEY");
        globalUser = User.retrieveMe();
    }

    /**
     * Test creating a child user.
     *
     * @throws EasyPostException when the request fails.
     */
    @Test
    @Disabled // This endpoint returns the child user keys in plain text, do not run this test.
    public void testCreate() throws EasyPostException {
        Map<String, Object> params = new HashMap<>();

        params.put("name", "Test User");

        User user = User.create(params);

        assertTrue(user instanceof User);
        assertTrue(user.getId().startsWith("user_"));
    }

    /**
     * Test retrieving a user.
     *
     * @throws EasyPostException when the request fails.
     */
    @Test
    public void testRetrieve() throws EasyPostException {
        User user = User.retrieve(Fixture.childUserID());

        assertTrue(user instanceof User);
        assertTrue(user.getId().startsWith("user_"));
    }

    /**
     * Test retrieving user itself.
     *
     * @throws EasyPostException when the request fails.
     */
    @Test
    public void testRetrieveMe() throws EasyPostException {
        User user = User.retrieveMe();

        assertTrue(user instanceof User);
        assertTrue(user.getId().startsWith("user_"));
    }

    /**
     * Test updating a user.
     *
     * @throws EasyPostException when the request fails.
     */
    @Test
// Path: src/main/java/com/easypost/exception/EasyPostException.java
// public class EasyPostException extends Exception {
// 
//     private static final long serialVersionUID = 1L;
//     private final String param;
// 
//     /**
//      * Constructor.
//      *
//      * @param message the exception message
//      */
//     public EasyPostException(final String message) {
//         super(message, null);
//         this.param = null;
//     }
// 
//     /**
//      * Constructor.
//      *
//      * @param message the exception message
//      * @param ex      the exception cause
//      */
//     public EasyPostException(final String message, final Throwable ex) {
//         super(message, ex);
//         this.param = null;
//     }
// 
//     /**
//      * Constructor.
//      *
//      * @param message the exception message
//      * @param param   the parameter name
//      * @param ex      the exception cause
//      */
//     public EasyPostException(final String message, final String param, final Throwable ex) {
//         super(message, ex);
//         this.param = param;
//     }
// 
//     /**
//      * Get the parameter name.
//      *
//      * @return the parameter name
//      */
//     public String getParam() {
//         return param;
//     }
// }


// Path: src/test/java/com/easypost/UserTest.java
import com.easypost.model.*;
import java.util.HashMap;
import java.util.Map;
import com.easypost.exception.EasyPostException;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeAll;
import static org.junit.jupiter.api.Assertions.*;

package com.easypost;





public class UserTest {
    private static User globalUser;

    /**
     * Setup the testing environment for this file.
     *
     * @throws EasyPostException when the request fails.
     */
    @BeforeAll
    public static void setUp() throws EasyPostException{
        EasyPost.apiKey = System.getenv("EASYPOST_PROD_API_KEY");
        globalUser = User.retrieveMe();
    }

    /**
     * Test creating a child user.
     *
     * @throws EasyPostException when the request fails.
     */
    @Test
    @Disabled // This endpoint returns the child user keys in plain text, do not run this test.
    public void testCreate() throws EasyPostException {
        Map<String, Object> params = new HashMap<>();

        params.put("name", "Test User");

        User user = User.create(params);

        assertTrue(user instanceof User);
        assertTrue(user.getId().startsWith("user_"));
    }

    /**
     * Test retrieving a user.
     *
     * @throws EasyPostException when the request fails.
     */
    @Test
    public void testRetrieve() throws EasyPostException {
        User user = User.retrieve(Fixture.childUserID());

        assertTrue(user instanceof User);
        assertTrue(user.getId().startsWith("user_"));
    }

    /**
     * Test retrieving user itself.
     *
     * @throws EasyPostException when the request fails.
     */
    @Test
    public void testRetrieveMe() throws EasyPostException {
        User user = User.retrieveMe();

        assertTrue(user instanceof User);
        assertTrue(user.getId().startsWith("user_"));
    }

    /**
     * Test updating a user.
     *
     * @throws EasyPostException when the request fails.
     */
    @Test
    public void testUpdate() throws EasyPostException {