diff --git a/backend/src/test/java/edu/zut/bookrider/integration/controller/BookControllerIT.java b/backend/src/test/java/edu/zut/bookrider/integration/controller/BookControllerIT.java index a05ca18b..8133189f 100644 --- a/backend/src/test/java/edu/zut/bookrider/integration/controller/BookControllerIT.java +++ b/backend/src/test/java/edu/zut/bookrider/integration/controller/BookControllerIT.java @@ -180,7 +180,7 @@ private Book createBook(String category, String language, String publisher, List @Test @WithMockUser(username = "librarian67:1", roles = {"librarian"}) void whenValidInput_returnDTO() throws Exception { - File exampleImage = new ClassPathResource("bookControllerTest/cat-2605502_1280.jpg").getFile(); + File exampleImage = new ClassPathResource("test_image.jpg").getFile(); String bookCoverString = Base64.getEncoder().encodeToString(java.nio.file.Files.readAllBytes(exampleImage.toPath())); List authors = new ArrayList<>(List.of("bcit_author1", "bcit_author2")); diff --git a/backend/src/test/java/edu/zut/bookrider/integration/controller/DriverApplicationControllerIT.java b/backend/src/test/java/edu/zut/bookrider/integration/controller/DriverApplicationControllerIT.java index 029f08e3..f4b70acc 100644 --- a/backend/src/test/java/edu/zut/bookrider/integration/controller/DriverApplicationControllerIT.java +++ b/backend/src/test/java/edu/zut/bookrider/integration/controller/DriverApplicationControllerIT.java @@ -98,8 +98,8 @@ void setUp() { @Test @WithMockUser(username = "driver@dacit.com", roles = {"driver"}) void whenValidInput_returnDTO() throws Exception { - File driverLicense = new ClassPathResource("driverApplicationServiceTest/driverLicence.jpg").getFile(); - File identityCard = new ClassPathResource("driverApplicationServiceTest/identityCard.jpg").getFile(); + File driverLicense = new ClassPathResource("test_image.jpg").getFile(); + File identityCard = new ClassPathResource("test_image.jpg").getFile(); String driverLicenseString = Base64.getEncoder().encodeToString(java.nio.file.Files.readAllBytes(driverLicense.toPath())); String identityCardString = Base64.getEncoder().encodeToString(java.nio.file.Files.readAllBytes(identityCard.toPath())); diff --git a/backend/src/test/java/edu/zut/bookrider/integration/controller/OrderControllerIT.java b/backend/src/test/java/edu/zut/bookrider/integration/controller/OrderControllerIT.java index f9289747..75bf3616 100644 --- a/backend/src/test/java/edu/zut/bookrider/integration/controller/OrderControllerIT.java +++ b/backend/src/test/java/edu/zut/bookrider/integration/controller/OrderControllerIT.java @@ -879,7 +879,7 @@ void whenDriverDeliversOrder_thenReturnOkAndDriverPayoutTransactionDTO() throws CoordinateDTO location = new CoordinateDTO(53.423, 14.553); - String imagePath = "src/test/resources/orderControllerTest/example_delivery_photo.png"; + String imagePath = "src/test/resources/test_image.jpg"; byte[] imageBytes = Files.readAllBytes(Paths.get(imagePath)); String base64Image = Base64.getEncoder().encodeToString(imageBytes); @@ -922,7 +922,7 @@ void whenDriverDeliversOrderWhenWrongStatus_thenThrowException() throws Exceptio CoordinateDTO location = new CoordinateDTO(10.0, 10.0); - String imagePath = "src/test/resources/orderControllerTest/example_delivery_photo.png"; + String imagePath = "src/test/resources/test_image.jpg"; byte[] imageBytes = Files.readAllBytes(Paths.get(imagePath)); String base64Image = Base64.getEncoder().encodeToString(imageBytes); @@ -963,7 +963,7 @@ void whenDriverDeliversOrderWhenDifferentDriver_thenThrowException() throws Exce CoordinateDTO location = new CoordinateDTO(10.0, 10.0); - String imagePath = "src/test/resources/orderControllerTest/example_delivery_photo.png"; + String imagePath = "src/test/resources/test_image.jpg"; byte[] imageBytes = Files.readAllBytes(Paths.get(imagePath)); String base64Image = Base64.getEncoder().encodeToString(imageBytes); @@ -996,7 +996,7 @@ void whenDriverDeliversOrderWhenTooFarAway_thenThrowException() throws Exception CoordinateDTO location = new CoordinateDTO(15.0, 15.0); - String imagePath = "src/test/resources/orderControllerTest/example_delivery_photo.png"; + String imagePath = "src/test/resources/test_image.jpg"; byte[] imageBytes = Files.readAllBytes(Paths.get(imagePath)); String base64Image = Base64.getEncoder().encodeToString(imageBytes); @@ -1226,7 +1226,7 @@ void whenDriverDeliversReturnOrder_thenReturnOkAndCreateRentalReturn() throws Ex CoordinateDTO location = new CoordinateDTO(53.423, 14.553); - String imagePath = "src/test/resources/orderControllerTest/example_delivery_photo.png"; + String imagePath = "src/test/resources/test_image.jpg"; byte[] imageBytes = Files.readAllBytes(Paths.get(imagePath)); String base64Image = Base64.getEncoder().encodeToString(imageBytes); diff --git a/backend/src/test/java/edu/zut/bookrider/integration/service/ImageUploadServiceIT.java b/backend/src/test/java/edu/zut/bookrider/integration/service/ImageUploadServiceIT.java index 819c4d56..2775f9e0 100644 --- a/backend/src/test/java/edu/zut/bookrider/integration/service/ImageUploadServiceIT.java +++ b/backend/src/test/java/edu/zut/bookrider/integration/service/ImageUploadServiceIT.java @@ -22,7 +22,7 @@ public class ImageUploadServiceIT { @Test void whenValidImage_thenDontThrowException() throws IOException { - byte[] imageBytes = Files.readAllBytes(Paths.get("src/test/resources/imageUploadServiceTest/example_image.jpg")); + byte[] imageBytes = Files.readAllBytes(Paths.get("src/test/resources/test_image.jpg")); // We have to mock it, since it's an interface populated by // Spring during an HTTP multipart request in a real application diff --git a/backend/src/test/java/edu/zut/bookrider/unit/service/ImageUploadServiceTest.java b/backend/src/test/java/edu/zut/bookrider/unit/service/ImageUploadServiceTest.java index 81723231..27d1cfab 100644 --- a/backend/src/test/java/edu/zut/bookrider/unit/service/ImageUploadServiceTest.java +++ b/backend/src/test/java/edu/zut/bookrider/unit/service/ImageUploadServiceTest.java @@ -37,7 +37,7 @@ static void setUp() throws IOException { @Test void whenValidImage_thenReturnUploadedImageUrl() throws IOException { - byte[] imageBytes = Files.readAllBytes(Paths.get("src/test/resources/imageUploadServiceTest/example_image.jpg")); + byte[] imageBytes = Files.readAllBytes(Paths.get("src/test/resources/test_image.jpg")); MultipartFile multipartFile = new MockMultipartFile( "imageFile", diff --git a/backend/src/test/resources/bookControllerTest/cat-2605502_1280.jpg b/backend/src/test/resources/bookControllerTest/cat-2605502_1280.jpg deleted file mode 100644 index 7b5bb7c5..00000000 Binary files a/backend/src/test/resources/bookControllerTest/cat-2605502_1280.jpg and /dev/null differ diff --git a/backend/src/test/resources/driverApplicationServiceTest/driverLicence.jpg b/backend/src/test/resources/driverApplicationServiceTest/driverLicence.jpg deleted file mode 100644 index 08eb81a3..00000000 Binary files a/backend/src/test/resources/driverApplicationServiceTest/driverLicence.jpg and /dev/null differ diff --git a/backend/src/test/resources/driverApplicationServiceTest/identityCard.jpg b/backend/src/test/resources/driverApplicationServiceTest/identityCard.jpg deleted file mode 100644 index 284601de..00000000 Binary files a/backend/src/test/resources/driverApplicationServiceTest/identityCard.jpg and /dev/null differ diff --git a/backend/src/test/resources/imageUploadServiceTest/example_image.jpg b/backend/src/test/resources/imageUploadServiceTest/example_image.jpg deleted file mode 100644 index c22dcd54..00000000 Binary files a/backend/src/test/resources/imageUploadServiceTest/example_image.jpg and /dev/null differ diff --git a/backend/src/test/resources/orderControllerTest/example_delivery_photo.png b/backend/src/test/resources/orderControllerTest/example_delivery_photo.png deleted file mode 100644 index aeb75d3c..00000000 Binary files a/backend/src/test/resources/orderControllerTest/example_delivery_photo.png and /dev/null differ diff --git a/backend/src/test/resources/test_image.jpg b/backend/src/test/resources/test_image.jpg new file mode 100644 index 00000000..af4b2109 Binary files /dev/null and b/backend/src/test/resources/test_image.jpg differ