Skip to content

Test: add unit tests for ClinicResponse mapping#174

Merged
TatjanaTrajkovic merged 2 commits into
mainfrom
test/unit_tests_clinic_dto
Apr 8, 2026
Merged

Test: add unit tests for ClinicResponse mapping#174
TatjanaTrajkovic merged 2 commits into
mainfrom
test/unit_tests_clinic_dto

Conversation

@TatjanaTrajkovic

@TatjanaTrajkovic TatjanaTrajkovic commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Verify that ClinicResponse.from() correctly maps all fields from Clinic entity, including id, name, address, and phoneNumber.

Summary by CodeRabbit

  • Tests
    • Added unit test coverage for clinic response mapping functionality.

Verify that ClinicResponse.from() correctly maps all fields from Clinic entity,
including id, name, address, and phoneNumber.
@TatjanaTrajkovic TatjanaTrajkovic linked an issue Apr 8, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Apr 8, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@TatjanaTrajkovic has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 4 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 18 minutes and 4 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 27989e42-b206-421c-b609-ebbf9c73365b

📥 Commits

Reviewing files that changed from the base of the PR and between f97b332 and 1e28b37.

📒 Files selected for processing (1)
  • src/test/java/org/example/vet1177/dto/response/clinic/ClinicResponseTest.java
📝 Walkthrough

Walkthrough

A new JUnit 5 test class ClinicResponseTest was added to validate the mapping logic of the ClinicResponse.from() method, ensuring that clinic entity fields are correctly transformed into response objects.

Changes

Cohort / File(s) Summary
Test Addition
src/test/java/org/example/vet1177/dto/response/clinic/ClinicResponseTest.java
Added unit test validating ClinicResponse.from() mapping with assertions for name, address, and phoneNumber fields.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

test

Suggested reviewers

  • annikaholmqvist94
  • lindaeskilsson

Poem

🐰 A test hops in with careful care,
Clinic responses mapped so fair,
Name and address, phone number true,
From entity to DTO through and through! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding unit tests for ClinicResponse mapping, which aligns with the single test method that verifies ClinicResponse.from() mapping functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/unit_tests_clinic_dto

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/test/java/org/example/vet1177/dto/response/clinic/ClinicResponseTest.java`:
- Around line 6-27: The test omits verifying id mapping: update
ClinicResponseTest.shouldMapFromEntityCorrectly to set the Clinic entity id to a
known UUID (e.g., via Clinic.setId(...) or using reflection if no setter) before
calling ClinicResponse.from(clinic), then add an assertion that response.id()
equals that UUID; locate the creation of Clinic and the UUID variable near
ClinicResponse.from to reuse the same UUID for setting the entity and for the
assertEquals comparison.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0d4fafb4-6fe0-46e3-b3d4-0b41cc4a09ad

📥 Commits

Reviewing files that changed from the base of the PR and between e652c86 and f97b332.

📒 Files selected for processing (1)
  • src/test/java/org/example/vet1177/dto/response/clinic/ClinicResponseTest.java

Ensure that ClinicResponse.from() correctly maps all fields from the Clinic entity, including id, name, address, and phoneNumber. Removed unused UUID variable and added assertion for id mapping.

@lindaeskilsson lindaeskilsson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snyggt!

@TatjanaTrajkovic
TatjanaTrajkovic merged commit f69c657 into main Apr 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test: Add Unit test for Clinic DTO

2 participants