Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> authors = new ArrayList<>(List.of("bcit_author1", "bcit_author2"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added backend/src/test/resources/test_image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.