Test: add unit tests for ActivityLog entity (constructor and prePersist)#151
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdded a JUnit 5 test class Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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/entities/ActivityLogTest.java`:
- Around line 47-54: The test's timestamp assertion is too broad; update
ActivityLogTest to capture Instant before = Instant.now() immediately before
calling log.onCreate(), then call log.onCreate(), capture Instant after =
Instant.now() immediately after, and replace the loose isBefore check with
assertions that log.getCreatedAt() is not null and that createdAt is
!before.isAfter(createdAt) (i.e., createdAt.compareTo(before) >= 0) and
!after.isBefore(createdAt) (i.e., createdAt.compareTo(after) <= 0) so createdAt
falls between the before and after timestamps; reference the test method that
calls log.onCreate() and uses log.getCreatedAt().
🪄 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: e7d9be63-ce60-4735-84af-a423d99d352d
📒 Files selected for processing (1)
src/test/java/org/example/vet1177/entities/ActivityLogTest.java
Summary by CodeRabbit