diff --git a/hartmann-foto-documentation-app/src/main/java/marketing/heyday/hartmann/fotodocumentation/core/utils/PdfUtils.java b/hartmann-foto-documentation-app/src/main/java/marketing/heyday/hartmann/fotodocumentation/core/utils/PdfUtils.java index da0e882..64115c0 100644 --- a/hartmann-foto-documentation-app/src/main/java/marketing/heyday/hartmann/fotodocumentation/core/utils/PdfUtils.java +++ b/hartmann-foto-documentation-app/src/main/java/marketing/heyday/hartmann/fotodocumentation/core/utils/PdfUtils.java @@ -33,7 +33,7 @@ import marketing.heyday.hartmann.fotodocumentation.core.model.Picture; * * created: 2 Feb 2026 */ - +@java.lang.SuppressWarnings("java:S818") public class PdfUtils { private static final Log LOG = LogFactory.getLog(PdfUtils.class); diff --git a/hartmann-foto-documentation-frontend/test/controller/customer_controller_test.dart b/hartmann-foto-documentation-frontend/test/controller/customer_controller_test.dart index 5695193..0298f74 100644 --- a/hartmann-foto-documentation-frontend/test/controller/customer_controller_test.dart +++ b/hartmann-foto-documentation-frontend/test/controller/customer_controller_test.dart @@ -51,6 +51,28 @@ void main() { var dto = await controller.get(id: 4); expect(dto, isA()); }); + + test('export a customer', () async { + final client = MockClient(); + DiContainer.instance.put(HttpClientUtils, TestHttpCLientUtilsImpl(client)); + + when(client.get(Uri.parse('http://localhost:8080/api/customer/export/4'), headers: {"Accept-Language": "en-US"})) + .thenAnswer((_) async => http.Response(_customerJson, 200)); + + var dto = await controller.export(customerId: 4); + expect(dto, isA>()); + }); + + test('export a customer picture', () async { + final client = MockClient(); + DiContainer.instance.put(HttpClientUtils, TestHttpCLientUtilsImpl(client)); + + when(client.get(Uri.parse('http://localhost:8080/api/customer/export/4?picture=1'), headers: {"Accept-Language": "en-US"})) + .thenAnswer((_) async => http.Response(_customerJson, 200)); + + var dto = await controller.export(customerId: 4, pictureId: 1); + expect(dto, isA>()); + }); } String _customersJson = '''[ diff --git a/hartmann-foto-documentation-frontend/test/controller/picture_controller_test.dart b/hartmann-foto-documentation-frontend/test/controller/picture_controller_test.dart index 55a0614..622c44a 100644 --- a/hartmann-foto-documentation-frontend/test/controller/picture_controller_test.dart +++ b/hartmann-foto-documentation-frontend/test/controller/picture_controller_test.dart @@ -15,7 +15,7 @@ void main() { var jwtTokenStorage = MockJwtTokenStorage(); when(jwtTokenStorage.getAccessToken()).thenAnswer((_) => null); DiContainer.instance.put(JwtTokenStorage, jwtTokenStorage); - + PictureController controller = PictureControllerImpl(); group('PictureControllerTest', () { @@ -26,6 +26,9 @@ void main() { test('returns false if delete failed', () async { _testDelete(controller, 404, false); }); + test('returns false if update evaluation failed', () async { + _testUpdateEvaluate(controller, 200, true); + }); }); } @@ -35,7 +38,19 @@ void _testDelete(PictureController controller, int response, bool expected) asyn when(client.delete(Uri.parse('http://localhost:8080/api/picture/4'), headers: {"Accept-Language": "en-US"})).thenAnswer((_) async => http.Response("", response)); - var dto = await controller.delete(PictureDto(id: 4, pictureDate: DateTime.now(), category: "", comment: "", evaluation: 1, username: "", imageUrl: "", normalSizeUrl: "", thumbnailSizeUrl: "")); + var dto = await controller + .delete(PictureDto(id: 4, pictureDate: DateTime.now(), category: "", comment: "", evaluation: 1, username: "", imageUrl: "", normalSizeUrl: "", thumbnailSizeUrl: "")); expect(dto, expected); } +void _testUpdateEvaluate(PictureController controller, int response, bool expected) async { + final client = MockClient(); + DiContainer.instance.put(HttpClientUtils, TestHttpCLientUtilsImpl(client)); + + when(client.put(Uri.parse('http://localhost:8080/api/picture/evaluation/4?evaluation=1'), headers: {"Accept-Language": "en-US"})) + .thenAnswer((_) async => http.Response("", response)); + + var dto = await controller.updateEvaluation( + PictureDto(id: 4, pictureDate: DateTime.now(), category: "", comment: "", evaluation: 1, username: "", imageUrl: "", normalSizeUrl: "", thumbnailSizeUrl: "")); + expect(dto, expected); +}