@Test public void testUpdatePetWithForm() throws Exception { Pet pet = createRandomPet(); pet.setName("frank"); api.addPet(pet); Pet fetched = api.getPetById(pet.getId()); api.updatePetWithForm(fetched.getId(), "furt", null); Pet updated = api.getPetById(fetched.getId()); assertEquals(updated.getName(), "furt"); }
@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()); } }
@Test public void testCreateAndGetPet() throws Exception { Pet pet = createRandomPet(); api.addPet(pet); Pet fetched = api.getPetById(pet.getId()); assertNotNull(fetched); assertEquals(pet.getId(), fetched.getId()); assertNotNull(fetched.getCategory()); assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); }
@Test public void testUpdatePet() throws Exception { Pet pet = createRandomPet(); pet.setName("programmer"); api.updatePet(pet); Pet fetched = api.getPetById(pet.getId()); assertNotNull(fetched); assertEquals(pet.getId(), fetched.getId()); assertNotNull(fetched.getCategory()); assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); }