@Before
 public void setup() {
   api = new PetApi();
   // setup authentication
   ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
   apiKeyAuth.setApiKey("special-key");
 }
  @Test
  public void testApiClient() {
    // the default api client is used
    assertEquals(Configuration.getDefaultApiClient(), api.getApiClient());
    assertNotNull(api.getApiClient());
    assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath());
    assertFalse(api.getApiClient().isDebugging());

    ApiClient oldClient = api.getApiClient();

    ApiClient newClient = new ApiClient();
    newClient.setBasePath("http://example.com");
    newClient.setDebugging(true);

    // set api client via constructor
    api = new PetApi(newClient);
    assertNotNull(api.getApiClient());
    assertEquals("http://example.com", api.getApiClient().getBasePath());
    assertTrue(api.getApiClient().isDebugging());

    // set api client via setter method
    api.setApiClient(oldClient);
    assertNotNull(api.getApiClient());
    assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath());
    assertFalse(api.getApiClient().isDebugging());
  }