@Test
public void testDXAPICustomEnvironment() throws IOException {

    DXEnvironment env = DXEnvironment.create();
    DXHTTPRequest c = new DXHTTPRequest(env);
    JsonNode responseJson =
            c.request("/system/findDataObjects", DXJSON.parseJson("{}"),
                    RetryStrategy.SAFE_TO_RETRY);
    Assert.assertEquals(responseJson.isObject(), true);
    // System.out.println(responseJson);
    String responseText =
            c.request("/system/findDataObjects", "{}", RetryStrategy.SAFE_TO_RETRY);
    Assert.assertEquals(responseText.substring(0, 1), "{");
    // Tests deserialization of InvalidAuthentication
    env = DXEnvironment.Builder.fromDefaults().setBearerToken("BOGUS").build();
    DXHTTPRequest c2 = new DXHTTPRequest(env);
    try {
        c2.request("/system/findDataObjects", DXJSON.parseJson("{}"),
                RetryStrategy.SAFE_TO_RETRY);
        Assert.fail("Expected findDataObjects to fail with InvalidAuthentication");
    } catch (InvalidAuthenticationException e) {
        // Error message should be something like
        // "the token could not be found"
        Assert.assertTrue(e.toString().contains("token"));
        Assert.assertEquals(401, e.getStatusCode());
    }
}