@Test public void testDeletePet() throws Exception { Pet pet = createRandomPet(); api.addPet(pet); Pet fetched = api.getPetById(pet.getId()); api.deletePet(fetched.getId(), null); try { fetched = api.getPetById(fetched.getId()); fail("expected an error"); } catch (ApiException e) { assertEquals(404, e.getCode()); } }