Skip to content

Comments

Add comprehensive unit tests for core and application layers#372

Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1771876332-add-unit-tests
Open

Add comprehensive unit tests for core and application layers#372
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1771876332-add-unit-tests

Conversation

@devin-ai-integration
Copy link

@devin-ai-integration devin-ai-integration bot commented Feb 23, 2026

Add unit tests for core domain and application layer classes

Summary

Adds 12 new unit test files and extends the existing ArticleTest to improve test coverage across previously untested core domain and application layer classes. All tests are pure unit tests (no Spring context required), with Mockito used only for ArticleCommandService.

New test files:

  • Core domain: UserTest, CommentTest, TagTest, FollowRelationTest, ArticleFavoriteTest, AuthorizationServiceTest
  • Application layer: UtilTest, PageTest, CursorPageParameterTest, CursorPagerTest, DateTimeCursorTest, ArticleCommandServiceTest

Extended: ArticleTest — added tests for update(), tag deduplication, empty tags, equality, and the two-arg constructor with explicit createdAt.

Modified (formatting only): DefaultJwtServiceTest — spotless auto-formatted a long line.

Total test count went from ~100 to 146, all passing.

Review & Testing Checklist for Human

  • ArticleCommandServiceTest: The service is @Validated in production, but these unit tests instantiate it directly with a mocked repo, so @NotBlank/@DuplicatedArticleConstraint validation is not exercised. Verify this is acceptable for unit-level coverage (integration tests elsewhere should cover validation).
  • CursorPagerTest cursor assertions: Start/end cursor assertions compare via .toString() because DateTimeCursor lacks equals(). Confirm this is a reasonable approach vs. comparing millis directly.
  • Run ./gradlew test locally to confirm all 146 tests pass and no flaky timing issues (some tests use new DateTime() which could theoretically cause issues around test boundaries).

Notes


Open with Devin

Add 12 new test files and extend existing ArticleTest with tests for:
- Core: User, Comment, Tag, FollowRelation, ArticleFavorite, AuthorizationService
- Application: Util, Page, CursorPageParameter, CursorPager, DateTimeCursor
- Service: ArticleCommandService (with mocked repository)

Tests cover constructors, equality, edge cases, and error conditions.

Co-Authored-By: unknown <>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

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.

1 participant