-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Update Spring Boot, Java version, and add tests #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Updates Spring Boot to version 3.5.0 and Java to version 17. This also introduces comprehensive unit tests for QR code generation and reading functionalities, covering both positive and negative scenarios. Key changes: - Updated `spring-boot-starter-parent` to 3.5.0 in `pom.xml`. - Updated `java.version` to 17 in `pom.xml`. - Updated Java version mentions in `README.md` to 17. - Replaced `javax.*` with `jakarta.*` namespaces for Spring Boot 3 compatibility. - Updated `springdoc-openapi-ui` to `springdoc-openapi-starter-webmvc-ui:2.5.0`. - Added `QrCodeServiceTests.java` with tests for: - Successful QR code generation. - QR code generation with null and empty inputs. - Successful QR code reading. - Reading invalid image formats and non-QR images. - Handling IOExceptions and unexpected content during QR reading. - Updated `README.md` to include a "Testing" section explaining the new tests and how to run them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the project to use Spring Boot 3.5.0 and Java 17, while replacing javax.* with jakarta.* namespaces and adding comprehensive unit tests for QR code generation and reading functionalities.
- Upgraded dependencies and Java version in pom.xml and README.md
- Replaced javax imports with jakarta in source and test files
- Introduced unit tests in QrCodeServiceTests.java to cover both positive and negative scenarios
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
target/surefire-reports/* | Updated test report files to reflect new tests and runtime environment |
target/maven-status/* | Updated maven status files for test and compile phases |
src/test/java/com/onurdesk/iris/service/QrCodeServiceTests.java | Added and updated test cases for QR code generation and reading |
src/main/java/com/onurdesk/iris/service/QrCodeService.java | Updated imports and added explicit content type for HTTP responses |
src/main/java/com/onurdesk/iris/dto/QrCodeGenerationRequestDto.java | Replaced javax with jakarta validation annotations |
src/main/java/com/onurdesk/iris/controller/QrCodeController.java | Replaced javax with jakarta validation and servlet annotations |
pom.xml | Upgraded Spring Boot, Java version, and springdoc dependencies |
README.md | Revised Java version and documentation details with new testing instructions |
Comments suppressed due to low confidence (1)
src/test/java/com/onurdesk/iris/service/QrCodeServiceTests.java:144
- [nitpick] Instead of relying on a NullPointerException when ImageIO.read returns null, consider throwing and testing for a custom exception with a clear error message to clearly indicate that the provided file is not a valid image.
assertThrows(NullPointerException.class, () -> {
qrCodeService.generate(dtoWithEmptyTitle, mockResponse); | ||
|
||
// Expecting "attachment;filename=.png" or similar, depending on implementation logic for empty title | ||
assertEquals("attachment;filename=.png", mockResponse.getHeader(HttpHeaders.CONTENT_DISPOSITION)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider handling empty title values explicitly—either by validating the DTO or providing a default filename—to avoid generating a filename like ".png".
assertEquals("attachment;filename=.png", mockResponse.getHeader(HttpHeaders.CONTENT_DISPOSITION)); | |
assertEquals("attachment;filename=default.png", mockResponse.getHeader(HttpHeaders.CONTENT_DISPOSITION)); |
Copilot uses AI. Check for mistakes.
|
||
###### Spring boot application exposing REST API endpoint to genrate QR-code representing custom message and another endpoint to read the decoded message, built using Java [Spring boot](https://onurdesk.com/category/spring/spring-boot/) and [google's zxing library](https://opensource.google/projects/zxing). | ||
###### Spring boot application exposing REST API endpoint to genrate QR-code representing custom message and another endpoint to read the decoded message, built using Java, [Spring Boot 3.5.0](https://spring.io/projects/spring-boot/) and [google's zxing library](https://opensource.google/projects/zxing). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The word 'genrate' is misspelled; consider correcting it to 'generate'.
###### Spring boot application exposing REST API endpoint to genrate QR-code representing custom message and another endpoint to read the decoded message, built using Java, [Spring Boot 3.5.0](https://spring.io/projects/spring-boot/) and [google's zxing library](https://opensource.google/projects/zxing). | |
###### Spring boot application exposing REST API endpoint to generate QR-code representing custom message and another endpoint to read the decoded message, built using Java, [Spring Boot 3.5.0](https://spring.io/projects/spring-boot/) and [google's zxing library](https://opensource.google/projects/zxing). |
Copilot uses AI. Check for mistakes.
Updates Spring Boot to version 3.5.0 and Java to version 17. This also introduces comprehensive unit tests for QR code generation and reading functionalities, covering both positive and negative scenarios.
Key changes:
spring-boot-starter-parent
to 3.5.0 inpom.xml
.java.version
to 17 inpom.xml
.README.md
to 17.javax.*
withjakarta.*
namespaces for Spring Boot 3 compatibility.springdoc-openapi-ui
tospringdoc-openapi-starter-webmvc-ui:2.5.0
.QrCodeServiceTests.java
with tests for:README.md
to include a "Testing" section explaining the new tests and how to run them.