### Question:
PetApi { public void addPet(Pet body) throws ApiException { addPetWithHttpInfo(body); } PetApi();  PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ApiResponse<Void> addPetWithHttpInfo(Pet body); void deletePet(Long petId, String apiKey); ApiResponse<Void> deletePetWithHttpInfo(Long petId, String apiKey); List<Pet> findPetsByStatus(List<String> status); ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(List<String> status); @Deprecated Set<Pet> findPetsByTags(Set<String> tags); @Deprecated ApiResponse<Set<Pet>> findPetsByTagsWithHttpInfo(Set<String> tags); Pet getPetById(Long petId); ApiResponse<Pet> getPetByIdWithHttpInfo(Long petId); void updatePet(Pet body); ApiResponse<Void> updatePetWithHttpInfo(Pet body); void updatePetWithForm(Long petId, String name, String status); ApiResponse<Void> updatePetWithFormWithHttpInfo(Long petId, String name, String status); ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file); ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file); ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata); ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata);  }### Answer:
@Test public void addPetTest() throws ApiException { Pet body = new Pet(); body.setId(petId); body.setName("jersey2 java8 pet"); Category category = new Category(); category.setId(petId); category.setName("jersey2 java8 category"); body.setCategory(category); body.setStatus(Pet.StatusEnum.AVAILABLE); body.setPhotoUrls(new HashSet<>(Arrays.asList("A", "B", "C"))); Tag tag = new Tag(); tag.setId(petId); tag.setName("jersey2 java8 tag"); body.setTags(Arrays.asList(tag)); api.addPet(body); Pet result = api.getPetById(petId); Assert.assertEquals(result.getId(), body.getId()); Assert.assertEquals(result.getCategory(), category); Assert.assertEquals(result.getName(), body.getName()); Assert.assertEquals(result.getPhotoUrls(), body.getPhotoUrls()); Assert.assertEquals(result.getStatus(), body.getStatus()); Assert.assertEquals(result.getTags(), body.getTags()); api.updatePetWithForm(petId, "jersey2 java8 pet 2", "sold"); Pet result2 = api.getPetById(petId); Assert.assertEquals(result2.getId(), body.getId()); Assert.assertEquals(result2.getCategory(), category); Assert.assertEquals(result2.getName(), "jersey2 java8 pet 2"); Assert.assertEquals(result2.getPhotoUrls(), body.getPhotoUrls()); Assert.assertEquals(result2.getStatus(), Pet.StatusEnum.SOLD); Assert.assertEquals(result2.getTags(), body.getTags()); api.deletePet(petId, "empty api key"); try { Pet result3 = api.getPetById(petId); Assert.assertEquals(false, true); } catch (ApiException e) { Assert.assertEquals(e.getCode(), 404); Assert.assertEquals(e.getResponseBody(), "{\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}"); } }