From c10bbb59af0536b9b218176d3b6b1625d87a6cc1 Mon Sep 17 00:00:00 2001 From: Ivaylo Ivanov Date: Sat, 28 Mar 2020 18:57:48 +0100 Subject: [PATCH] TS13: Remove duplicate tests and fix wording --- .../integration/HorseEndpointTest.java | 35 ------------------- .../integration/OwnerEndpointTest.java | 19 +--------- 2 files changed, 1 insertion(+), 53 deletions(-) diff --git a/backend/src/test/java/at/ac/tuwien/sepm/assignment/individual/integration/HorseEndpointTest.java b/backend/src/test/java/at/ac/tuwien/sepm/assignment/individual/integration/HorseEndpointTest.java index c04e77d..551ec12 100644 --- a/backend/src/test/java/at/ac/tuwien/sepm/assignment/individual/integration/HorseEndpointTest.java +++ b/backend/src/test/java/at/ac/tuwien/sepm/assignment/individual/integration/HorseEndpointTest.java @@ -146,41 +146,6 @@ public class HorseEndpointTest { assertEquals(newHorse.getOwner(), response.getBody().getOwner()); } - @Test - @DisplayName("Updating a horse with the correct parameters will return 200 and the new HorseDto") - public void updatingNewHorse_correctParameters_shouldReturnStatus200AndHorse() { - HorseDto newHorse = new HorseDto("Zephyr", "Nice horse", (short) 4, Date.valueOf("2020-01-01"), ERace.APPALOOSA, "files/test.png", null); - - // Create a new horse - HttpEntity request = new HttpEntity<>(newHorse); - ResponseEntity response = REST_TEMPLATE - .exchange(BASE_URL + port + HORSE_URL, HttpMethod.POST, request, HorseDto.class); - - // Update the horse - newHorse.setId(response.getBody().getId()); - newHorse.setName("Katrina"); - newHorse.setDescription("Fast horse"); - newHorse.setScore((short) 3); - newHorse.setBirthday(Date.valueOf("2005-01-01")); - newHorse.setRace(ERace.MORGAN); - newHorse.setImagePath("files/katrina.png"); - newHorse.setOwner(null); - - request = new HttpEntity<>(newHorse); - response = REST_TEMPLATE - .exchange(BASE_URL + port + HORSE_URL + '/' + newHorse.getId(), HttpMethod.PUT, request, HorseDto.class); - - // Compare everything except timestamps - assertEquals(response.getStatusCode(), HttpStatus.OK); - assertEquals(newHorse.getId(), response.getBody().getId()); - assertEquals(newHorse.getName(), response.getBody().getName()); - assertEquals(newHorse.getDescription(), response.getBody().getDescription()); - assertEquals(newHorse.getScore(), response.getBody().getScore()); - assertEquals(newHorse.getBirthday().toString(), response.getBody().getBirthday().toString()); - assertEquals(newHorse.getImagePath(), response.getBody().getImagePath()); - assertEquals(newHorse.getOwner(), response.getBody().getOwner()); - } - @Test @DisplayName("Uploading an image in the correct format will return HTTP 201") public void addingNewImage_correctFormat_shouldReturnStatus201() { diff --git a/backend/src/test/java/at/ac/tuwien/sepm/assignment/individual/integration/OwnerEndpointTest.java b/backend/src/test/java/at/ac/tuwien/sepm/assignment/individual/integration/OwnerEndpointTest.java index 9df6938..a395dba 100644 --- a/backend/src/test/java/at/ac/tuwien/sepm/assignment/individual/integration/OwnerEndpointTest.java +++ b/backend/src/test/java/at/ac/tuwien/sepm/assignment/individual/integration/OwnerEndpointTest.java @@ -195,24 +195,7 @@ public class OwnerEndpointTest { assertEquals(newOwner.getId(), response.getBody().getId()); assertEquals(newOwner.getName(), response.getBody().getName()); } - - @Test - @DisplayName("Deleting an existing owner without horses will return HTTP 204") - public void deletingOwner_existingNoOwnersOwned_shouldReturnStatus204() { - // Create the owner - OwnerDto newOwner = new OwnerDto("Chad"); - - HttpEntity request = new HttpEntity<>(newOwner); - ResponseEntity response = REST_TEMPLATE - .exchange(BASE_URL + port + OWNER_URL, HttpMethod.POST, request, OwnerDto.class); - - // Delete and test if deleted - ResponseEntity res = REST_TEMPLATE - .exchange(BASE_URL + port + OWNER_URL + '/' + response.getBody().getId(), HttpMethod.DELETE, null, new ParameterizedTypeReference() {}); - - assertEquals(res.getStatusCode(), HttpStatus.NO_CONTENT); - } - + @Test @DisplayName("Deleting an existing owner without horses will return HTTP 204") public void deletingOwner_existingNoHorsesOwned_shouldReturnStatus204() {