Add tests for the five lowest-coverage modules and enforce the coverage gate - #293
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Runtime verification (test-only PR)Booted the branch ( Unit suite: REST golden path (register → article → tags → favorite → comment)Registered a user, published "PR293 Verification Article" with tag GraphQL (DGS) layer
Negative paths
Pre-existing issues found (not introduced by this PR)
|
…nerated types from coverage




Summary
Baseline
./gradlew test jacocoTestReportshowed 34.1% line coverage (738/2167). The five lowest-coverage hand-written packages were:io.spring.graphql(datafetchers/mutations)io.spring.graphql.exceptionio.spring.application.article(ArticleCommandService)io.spring.infrastructure.mybatis(DateTimeHandler)io.spring.core.service/io.spring.application(ArticleQueryServicecursor paths)21 new test classes, 208 tests total (was 172), all green.
./gradlew buildnow passes with the 80% JaCoCo gate enabled — line coverage 98.4%, instruction 98.7%, branch 90.2%.Patterns follow the existing suite:
@WebMvcTest+ RestAssuredMockMvc for controllers (TagsApiTest), standaloneMockMvcwithsetControllerAdviceforCustomizeExceptionHandler, Mockito@Mock/@InjectMocksfor services and GraphQL datafetchers, andDbTestBase(@MybatisTest) for repository/read-service integration (CommentQueryServiceCursorTest).GraphQL security state is driven directly through the security context, via a shared base class:
Negative cases covered throughout: anonymous access to every mutation, non-owner update/delete (
NoAuthorizationException), unknown slug/username/comment/relation (ResourceNotFoundException), wrong password / unknown email (InvalidAuthenticationException), registration constraint violations mapped toBAD_REQUESTGraphQL errors, invalid pagination (neitherfirstnorlast→IllegalArgumentException), and empty result pages.Two non-test changes
Bug found while verifying the running app: unauthenticated GraphQL mutations were blocked but surfaced as
errorType: INTERNAL, because the datafetchers throwio.spring.graphql.exception.AuthenticationExceptionwhile the handler only mappedio.spring.api.exception.InvalidAuthenticationException:Coverage gate scoping: DGS codegen output (
io/spring/graphql/types/**,DgsConstants) is excluded from the JaCoCo report and verification, andlombok.configsetslombok.addLombokGeneratedAnnotation = trueso JaCoCo ignores Lombok-generated getters/equals/builders. Without these, the gate measures generated code rather than the code under test.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/9e1ca0417d374553b2b7eb5e5f7c2ea5