Skip to content

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

Merged
merged 1 commit into from
Jun 17, 2025

Conversation

thecoder8890
Copy link
Owner

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.

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.
@thecoder8890 thecoder8890 requested a review from Copilot June 17, 2025 15:50
Copy link

@Copilot Copilot AI left a 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));
Copy link
Preview

Copilot AI Jun 17, 2025

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".

Suggested change
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).
Copy link
Preview

Copilot AI Jun 17, 2025

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'.

Suggested change
###### 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.

@thecoder8890 thecoder8890 merged commit 2f40685 into main Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant