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 and google's zxing library.
Recommended way is to use sdkman for installing both maven and java
Run the below commands in the core
mvn clean install
mvn spring-boot:run
server port is configured to 9090 which can be changed in application.properties file
Go to the below url to view swagger-ui (API docs)
http://localhost:9090/swagger-ui.html
The core QR code generation and reading functionalities are tested in src/test/java/com/onurdesk/iris/service/QrCodeServiceTests.java
. These tests cover:
- Positive Scenarios:
- Successful QR code generation with valid text input.
- Successful reading and decoding of a valid QR code image.
- Negative Scenarios:
- Attempting QR code generation with null or invalid DTO.
- Handling of empty title during QR code generation.
- Attempting to read invalid image files (not images or not QR codes).
- Attempting to read QR codes with unexpected content (not deserializable to the expected DTO).
- Handling I/O exceptions during file reading.
You can run the tests using Maven:
mvn test
Alternatively, running mvn clean install
will also execute the tests as part of the build lifecycle.