Skip to content

feat: implement service tests for comment- and fileLog#53

Merged
eeebbaandersson merged 2 commits into
mainfrom
feature/missing-log-tests
Apr 24, 2026
Merged

feat: implement service tests for comment- and fileLog#53
eeebbaandersson merged 2 commits into
mainfrom
feature/missing-log-tests

Conversation

@eeebbaandersson

@eeebbaandersson eeebbaandersson commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Tests
    • Added unit tests for audit logging services (comments and files) covering create/save behavior and retrieval, validating mapping, persistence calls, and correct list-returning logic to improve reliability.

@coderabbitai

coderabbitai Bot commented Apr 24, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1c11376f-5bce-4e06-adc4-431fa9652df9

📥 Commits

Reviewing files that changed from the base of the PR and between 5cc6d4d and fdbe819.

📒 Files selected for processing (1)
  • src/test/java/org/example/visacasemanagementsystem/audit/service/CommentLogServiceTest.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/test/java/org/example/visacasemanagementsystem/audit/service/CommentLogServiceTest.java

📝 Walkthrough

Walkthrough

Adds two new JUnit 5 test classes that verify CommentLogService and FileLogService behaviors using Mockito mocks for repositories and mappers; tests cover creation (mapping + save) and retrieval (findAll + map to DTOs).

Changes

Cohort / File(s) Summary
Audit Service Unit Tests
src/test/java/org/example/visacasemanagementsystem/audit/service/CommentLogServiceTest.java, src/test/java/org/example/visacasemanagementsystem/audit/service/FileLogServiceTest.java
Adds unit test suites using Mockito. Each suite tests a create method (verifies mapper.toEntity and repository.save calls) and a findAll method (stubs repository.findAll, maps to DTOs, verifies return size and call counts).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • EdvinSandgren

Poem

🐰 I hopped through tests with mock and glee,
Mapping logs and saving, as busy as can be.
Assertions like carrots, lined up in a row,
Services vetted, tidy — now onward I go! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding service tests for CommentLogService and FileLogService, which is exactly what the changeset introduces.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/missing-log-tests

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

🧹 Nitpick comments (1)
src/test/java/org/example/visacasemanagementsystem/audit/service/CommentLogServiceTest.java (1)

56-56: Nit: method name findAll_shouldReturnDtoToList reads awkwardly.

Consider findAll_shouldReturnDtoList (matching the sibling test in FileLogServiceTest) for consistency and readability.

✏️ Proposed rename
-    void findAll_shouldReturnDtoToList() {
+    void findAll_shouldReturnDtoList() {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/test/java/org/example/visacasemanagementsystem/audit/service/CommentLogServiceTest.java`
at line 56, Rename the test method findAll_shouldReturnDtoToList in
CommentLogServiceTest to findAll_shouldReturnDtoList to match the sibling test
naming in FileLogServiceTest; update the method declaration in the
CommentLogServiceTest class and any references to that method (e.g., test
runners or IDE usages) so the new name is used consistently.
🤖 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/visacasemanagementsystem/audit/service/CommentLogServiceTest.java`:
- Line 21: The class-level `@DisplayName` on CommentLogServiceTest is incorrectly
copy-pasted as "FileLogService unit tests"; update the `@DisplayName` annotation
on the CommentLogServiceTest class to a correct, descriptive label (e.g.,
"CommentLogService unit tests") so test reports and IDE runners show the right
name; locate the annotation on the CommentLogServiceTest class and replace the
string value accordingly.

---

Nitpick comments:
In
`@src/test/java/org/example/visacasemanagementsystem/audit/service/CommentLogServiceTest.java`:
- Line 56: Rename the test method findAll_shouldReturnDtoToList in
CommentLogServiceTest to findAll_shouldReturnDtoList to match the sibling test
naming in FileLogServiceTest; update the method declaration in the
CommentLogServiceTest class and any references to that method (e.g., test
runners or IDE usages) so the new name is used consistently.
🪄 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: a7e4ad83-8edc-47c4-b459-5c538fbf77bf

📥 Commits

Reviewing files that changed from the base of the PR and between 325552a and 5cc6d4d.

📒 Files selected for processing (2)
  • src/test/java/org/example/visacasemanagementsystem/audit/service/CommentLogServiceTest.java
  • src/test/java/org/example/visacasemanagementsystem/audit/service/FileLogServiceTest.java

@eeebbaandersson

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 24, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@eeebbaandersson eeebbaandersson linked an issue Apr 24, 2026 that may be closed by this pull request
@eeebbaandersson
eeebbaandersson merged commit 39b89d1 into main Apr 24, 2026
2 checks passed
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.

Add tests for remaining Audit package (CommentLog & FileLog)

1 participant