Code Monkey home page Code Monkey logo

pmoustopoulos / department-api Goto Github PK

View Code? Open in Web Editor NEW
25.0 3.0 7.0 3.5 MB

A Spring Boot 3 RESTful API for managing departments and employees. Features include CRUD operations, Excel/PDF reporting with JasperReport, async email sending with Thymeleaf, Dockerized PostgreSQL, and database migrations with Flyway. Enhanced with Swagger documentation, and tested using JUnit 5, Mockito, and Testcontainers.

Java 99.24% Dockerfile 0.06% HTML 0.69%
api-documentation crud docker excel-reports integration-testing java java17 jpa mockito pdf-reports

department-api's Issues

Fix Disabled Unit Tests in ReportServiceImplTest class

Issue Description

The ReportServiceImplTest class in the src/test/java/com/ainigma100/departmentapi/service/impl/ directory has two disabled unit tests.

The first test, givenNoInput_whenGenerateAndZipReports_thenReturnFileDTO, is meant to verify that the method generates and zips reports correctly when there is data available. It sets up mock data and mock behavior for the dependencies and asserts that the resulting FileDTO object is not null and contains the expected file content. The verification is done using various verify statements to ensure that the dependencies are invoked with the expected arguments.

The second test, givenNoInput_whenGenerateAndZipReports_thenReturnFileDTOWithEmptyContent, is meant to verify the behavior when there is no data available for the reports. It sets up mock data and behavior to simulate an empty result from the repository and asserts that the resulting FileDTO object is not null but has a null file content. Similarly, the dependencies' invocations are verified using verify statements.

Missing verification of generated reports in ReportControllerIntegrationTest

Issue Description

The ReportControllerIntegrationTest class in the src/test/java/com/ainigma100/departmentapi/integration/ directory is missing verification steps for the generated reports. The tests currently only check the HTTP response status, but they do not verify the content or correctness of the reports themselves. JasperReport libraries were used to generate the reports.

Steps to Reproduce

  1. Set up the project and execute the ReportControllerIntegrationTest class.
  2. Review the tests givenNoInput_whenGenerateDepartmentsExcelReport, givenNoInput_whenGenerateEmployeesExcelReport, givenNoInput_whenGeneratePdfFullReport, givenNoInput_whenGenerateAndZipReports, and givenNoInput_whenGenerateMultiSheetExcelReport.
  3. Notice that the tests only verify the HTTP response status and do not perform any assertions on the actual report content.

Expected Behavior

The integration tests for generating reports should include assertions to verify that the generated reports, created using the JasperReport libraries (version 6.20.5), contain the correct values, ensuring their accuracy and integrity.

Proposed Solution

To fix this issue, we need to modify the ReportControllerIntegrationTest class and add appropriate assertions to verify the content of the generated reports. This may involve using the JasperReport API to extract the report data from the response, parsing it, and asserting on specific values or structures.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.