Skip to content

Add comprehensive unit tests to reach 80% JaCoCo coverage threshold#147

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1781526936-test-generation
Open

Add comprehensive unit tests to reach 80% JaCoCo coverage threshold#147
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1781526936-test-generation

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Adds 16 new test files (~2900 lines) to bring JaCoCo instruction coverage from 33% → 87% and line coverage from 34% → 89%, passing the jacocoTestCoverageVerification gate (80% minimum). No production code was modified.

Coverage before → after

Metric Before After
Instructions 33.2% (3486/10497) 87.1% (9148/10497)
Lines 34.1% (738/2167) 89.5% (1940/2167)

Test classes added

GraphQL layer (previously 0.5–4.5% coverage → ~96%):

  • ArticleDatafetcherTest — feed, userFeed, userFavorites, userArticles, pagination cursors
  • ArticleMutationTest — create/update/delete/favorite/unfavorite with auth checks
  • CommentDatafetcherTest — article comments with cursor pagination
  • CommentMutationTest — create/delete with authorization
  • UserMutationTest — register/login/update user flows
  • MeDatafetcherTest — current user query via JWT
  • ProfileDatafetcherTest — profile lookups and author resolution
  • RelationMutationTest — follow/unfollow with auth
  • TagDatafetcherTest — tag listing
  • SecurityUtilTest — authenticated/anonymous user extraction
  • GraphQLCustomizeExceptionHandlerTest — error mapping for validation + auth exceptions

Application/service layer:

  • ArticleCommandServiceTest — article creation and update commands
  • CursorPagerTest — keyset pagination utilities and cursor parsing
  • DataClassTest — Lombok-generated data class coverage (ArticleData, CommentData, ProfileData, etc.)

Core domain layer:

  • CoreDomainTest — Article, User, Comment, Tag, FollowRelation, ArticleFavorite, AuthorizationService

Generated DGS types:

  • GraphQLTypesTest — builder/setter/equals/hashCode coverage for all generated GraphQL types

Testing patterns followed

All tests follow existing conventions:

  • JUnit 5 + Mockito for service/GraphQL layer
  • SecurityContextHolder with TestingAuthenticationToken / AnonymousAuthenticationToken for auth testing
  • DgsDataFetchingEnvironment mocks for datafetcher argument resolution

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/c8713192767f4ce5a1c15fa6cc5ac5df
Requested by: @bsmitches


Open in Devin Review

- Add GraphQL datafetcher tests: ArticleDatafetcher, CommentDatafetcher,
  MeDatafetcher, ProfileDatafetcher, TagDatafetcher
- Add GraphQL mutation tests: ArticleMutation, CommentMutation,
  UserMutation, RelationMutation
- Add SecurityUtil test
- Add GraphQLCustomizeExceptionHandler test
- Add ArticleCommandService test
- Add CursorPager and pagination utility tests
- Add data class tests (ArticleData, CommentData, ProfileData, etc.)
- Add generated DGS types test (builder/setter/equals coverage)
- Add CoreDomain test (Article, User, Comment, Tag, AuthorizationService)

Coverage improvement: 33% -> 87% (instructions), 34% -> 89% (lines)
All tests pass, no production code modified.
@devin-ai-integration

Copy link
Copy Markdown
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, CI, and merge conflict monitoring

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

Copy link
Copy Markdown
Author

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 bugs or issues to report.

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