π§ͺ Tester view
Untested behaviours, edge cases, test gap inventory Β· QA Engineer, SDET, Test Lead
β‘ Agent trace Β· 13 steps Β· $0.0554 Β· click to expand
search_claims(query='error handling exception caught swallowed', category='behavioral') β
search_claims(query='test coverage unit test', category='any') β
search_claims(category='behavioral', max_results=30) β
search_claims(category='behavioral', max_results=30) β
read_source_file(file_path='src/main/java/io/spring/core/article/Article.java', start_line=40) β
read_source_file(file_path='src/main/java/io/spring/application/DateTimeCursor.java', start_line=1) β
read_source_file(file_path='src/main/java/io/spring/infrastructure/service/DefaultJwtService.java', start_line=1) β
search_claims(category='behavioral', max_results=30) β
search_claims(category='behavioral', max_results=25) β
read_source_file(end_line=62, file_path='src/main/java/io/spring/api/security/JwtTokenFilter.java') β
search_claims(category='behavioral', max_results=30) β
read_source_file(end_line=100, file_path='src/main/java/io/spring/application/ArticleQueryService.java') β
read_source_file(end_line=44, file_path='src/main/java/io/spring/application/CursorPager.java') β
search_claims(category='behavioral', max_results=25) β
read_source_file(end_line=108, file_path='src/main/java/io/spring/api/exception/CustomizeExceptionHandler.java') β
read_source_file(end_line=105, file_path='src/main/java/io/spring/application/user/UserService.java') β
read_source_file(end_line=108, file_path='src/main/java/io/spring/graphql/exception/GraphQLCustomizeExceptionHandler.java') β
search_claims(category='behavioral', max_results=25) β
search_claims(category='behavioral', max_results=25) β
read_source_file(end_line=85, file_path='src/main/java/io/spring/api/CommentsApi.java') β
search_claims(category='behavioral', max_results=20) β
read_source_file(end_line=40, file_path='src/main/java/io/spring/api/ArticleFavoriteApi.java') β
read_source_file(end_line=45, file_path='src/main/java/io/spring/infrastructure/mybatis/DateTimeHandler.java') β
read_source_file(end_line=35, file_path='src/main/java/io/spring/infrastructure/repository/MyBatisArticleFavoriteRepository.java') β
read_source_file(end_line=160, file_path='src/main/java/io/spring/application/ArticleQueryService.java')
Test Intelligence Report
Codebase: Spring Boot "RealWorld" API (REST + GraphQL), 909 claims / 116 files. Focus: Risk-ranked behaviours, edge cases, error-handling gaps, and concrete test scenarios grounded in source.
High-Risk Untested Behaviours
Ranked by blast radius (auth β data integrity β pagination β domain).
-
JWT filter silently ignores malformed
Authorizationheaders β no test for the split edge cases.JwtTokenFilter.getTokenStringreturnsOptional.empty()when the header isnull(line 51) or whensplit.length < 2(line 55), and otherwise returnsOptional.ofNullable(split[1])(line 58). There is no test covering"Bearer"(no token),"Bearer "(trailing space βsplitlength 1), or a header with extra spaces. These all degrade to anonymous access rather than an error.src/main/java/io/spring/api/security/JwtTokenFilter.java:50-61 -
getSubFromTokenswallows all exceptions and returnsOptional.empty().catch (Exception e) { return Optional.empty(); }β expired, malformed, wrong-key, and null tokens are indistinguishable. Tests exist for"123"and one expired token (DefaultJwtServiceTest.java:29-40), but not for a token signed with a different secret, a token with a null subject, or a token whose subject is an empty string.src/main/java/io/spring/infrastructure/service/DefaultJwtService.java:40-49 -
Article.updatere-derives the slug on title change but leaves it stale on description/body-only updates. Only the title branch callstoSlug(line 54); description (57-60) and body (61-64) branches updateupdatedAtbut notslug. No test asserts slug stability/change semantics across partial updates.src/main/java/io/spring/core/article/Article.java:51-65 -
ArticleFavoriteRepository.saveis a silent no-op on duplicate favorites.if (mapper.find(...) == null) { mapper.insert(...) }β favoriting twice is idempotent but untested for the duplicate case.src/main/java/io/spring/infrastructure/repository/MyBatisArticleFavoriteRepository.java:19-24 -
unfavoriteArticlewhen no favorite exists. The claim notes it only removesifPresent; the API still returns 200 with article data. No test covers "unfavorite something never favorited."src/main/java/io/spring/api/ArticleFavoriteApi.java:39-40,src/main/java/io/spring/graphql/ArticleMutation.java:72-83 -
DateTimeCursor.parsethrows on non-numeric cursors.Long.parseLong(cursor)(line 21) is unguarded β a client-supplied cursor like"abc"throwsNumberFormatException, which is not mapped to a 4xx. Only thenullcase is handled (18-20).src/main/java/io/spring/application/DateTimeCursor.java:17-22 -
CursorPageParameter.setLimitboundary behaviour. Caps atMAX_LIMIT(1000) and ignores non-positive limits (leaving the default). No test assertslimit=0,limit=-1, orlimit=5000.src/main/java/io/spring/application/CursorPageParameter.java:33-39
Edge Case Inventory
| Area | Boundary / special input | Source |
|---|---|---|
| Slug generation | &, CJK punctuation \uFE30-\uFFA0, curly quotes β β, whitespace, ?, ,, . all collapse to -; lowercased |
Article.java:67-69 |
| Slug generation | Title with only special chars β slug becomes "-" (or empty-ish); no test |
Article.java:68 |
| Slug generation | Leading/trailing spaces β leading/trailing hyphens; no trimming | Article.java:68 |
| Article update | Empty/blank title/description/body are ignored (no-op) via Util.isEmpty |
Article.java:51-65 |
| User update | Same conditional-update semantics per field | User.java:29-49 |
Util.isEmpty |
null or length-0 β true; whitespace-only string β false (not trimmed) |
Util.java:5 |
| Cursor parse | null β null; non-numeric β NumberFormatException |
DateTimeCursor.java:17-22 |
| Cursor limit | >1000 capped; <=0 ignored (default retained) |
CursorPageParameter.java:33-39 |
| Cursor query limit | getQueryLimit() returns limit + 1 (fetch-one-extra pattern) |
CursorPageParameter.java:25-27 |
| Pagination | Empty result β getStartCursor()/getEndCursor() return null |
CursorPager.java:32-38 |
| Pagination | PREV direction reverses the list; NEXT does not |
ArticleQueryService.java:69-71, 92-94 |
| Pagination | Both first and last null β IllegalArgumentException |
ArticleDatafetcher.java:42-86, CommentDatafetcher.java:50-100 |
| Favorite count | countMap.get(id) may return null if no count row β favoritesCount set to null |
ArticleQueryService.java:157-158 |
| JWT | sessionTime * 1000L β intΓlong, safe; but sessionTime from config unvalidated |
DefaultJwtService.java:51-53 |
| DateTime | null DateTime β setTimestamp(..., null) |
DateTimeHandler.java:20-25 |
| GraphQL error path | getParam on a 1-segment path returns the whole string; on β₯2 segments drops the first two |
GraphQLCustomizeExceptionHandler.java:95-102 |
Error Handling Gaps
HIGH β Silent failures (exceptions caught and swallowed):
-
DefaultJwtService.getSubFromTokenβcatch (Exception e) { return Optional.empty(); }. Every failure mode (expired, tampered, wrong key, malformed) collapses to "no subject," which the filter treats as anonymous. A tampered token is indistinguishable from no token.DefaultJwtService.java:46-48 -
JwtTokenFilterβgetTokenStringreturns empty for malformed headers with no logging;userRepository.findById(id).ifPresent(...)silently does nothing if the token's subject no longer maps to a user (deleted user with valid token β anonymous).JwtTokenFilter.java:28-45, 50-61 -
ArticleFavoriteRepository.saveβ duplicate favorite silently skipped, no signal to caller.MyBatisArticleFavoriteRepository.java:20-24
MEDIUM β Unmapped exceptions / missing handlers:
-
DateTimeCursor.parseβNumberFormatExceptionfromLong.parseLongis not handled byCustomizeExceptionHandler(which only handlesInvalidRequestException,InvalidAuthenticationException,ConstraintViolationException,MethodArgumentNotValidException). A bad cursor likely surfaces as a 500.DateTimeCursor.java:21,CustomizeExceptionHandler.java:27-87 -
ArticleFavoriteApi.favoriteArticleβarticleQueryService.findBySlug(slug, user).get()calls.get()on anOptionalwithoutisPresentcheck (line 36). If the article was deleted between thefindBySluglookup and this call, this throwsNoSuchElementException.ArticleFavoriteApi.java:36 -
CommentsApi.createCommentβcommentQueryService.findById(comment.getId(), user).get()(line 50) β same unguarded.get()pattern.CommentsApi.java:50
LOW β Inconsistent status mapping:
CustomizeExceptionHandlerreturns 422 forInvalidAuthenticationException(login failure) rather than 401 β intentional per tests but worth locking down.CustomizeExceptionHandler.java:50-60
Suggested Test Scenarios
Auth / JWT
- Given header "Bearer" (no token), When GET /user, Then 401 (not 500). JwtTokenFilter.java:55
- Given a token signed with a different secret, When getSubFromToken, Then Optional.empty(). DefaultJwtService.java:44-48
- Given a valid token whose subject user was deleted, When GET /user, Then 401. JwtTokenFilter.java:33-43
Slug / Article
- Given title "Hello, World?!", When toSlug, Then "hello-world-" (trailing hyphen from ?!). Article.java:68
- Given title "δ½ ε₯½" (CJK), When toSlug, Then "-". Article.java:68
- Given an article, When update(null, "new desc", null), Then slug unchanged, description updated, updatedAt advanced. Article.java:57-60
- Given an article, When update("New Title", null, null), Then slug recomputed from new title. Article.java:52-56
Pagination
- Given cursor "abc", When DateTimeCursor.parse, Then a mapped 4xx (currently NumberFormatException). DateTimeCursor.java:21
- Given limit=5000, When setLimit, Then limit == 1000. CursorPageParameter.java:33-39
- Given limit=0, When setLimit, Then limit retains default. CursorPageParameter.java:33-39
- Given a PREV page with hasExtra=true, When CursorPager constructed, Then hasPrevious()==true, hasNext()==false. CursorPager.java:18-21
- Given an empty result set, When getStartCursor(), Then null. CursorPager.java:32-34
Favorites / Comments
- Given a user already favorited an article, When favoriteArticle again, Then no duplicate row and 200. MyBatisArticleFavoriteRepository.java:20-24
- Given a user never favorited, When DELETE /articles/{slug}/favorite, Then 200 (idempotent). ArticleFavoriteApi.java:39-40
- Given a comment on an article, When a non-author/non-article-owner deletes it, Then 403. CommentsApi.java:78-80, AuthorizationService.java:12-14
User update
- Given user A updates email to user B's email, When updateUser, Then 422 "email already exist". UserService.java:74-105
- Given user A updates email to their own current email, When updateUser, Then success (equality check passes). UserService.java:80-81
Complex Code Paths
-
ArticleQueryService.findRecentArticlesWithCursor/findUserFeedWithCursorβ branching on empty result,hasExtratrim,PREVreversal, thenfillExtraInfo. Four interacting conditions; the reversal-after-trim ordering is easy to get wrong.ArticleQueryService.java:54-98 -
ArticleQueryService.fillExtraInfoβ null-user guard skipssetIsFavorite/setIsFollowingAuthorbut always runssetFavoriteCount;countMap.get(id)can yieldnull.ArticleQueryService.java:125-159 -
CursorPagerconstructor β direction-dependent flag assignment (nextvsprevious).CursorPager.java:12-22 -
GraphQLCustomizeExceptionHandler.getParamβsplit("\\.")with 1-segment vs β₯2-segment branches;Arrays.copyOfRange(splits, 2, ...)on a 2-segment path returns an empty array β empty string.GraphQLCustomizeExceptionHandler.java:95-102 -
UpdateUserValidator.isValidβ two independent uniqueness checks combined with&&, each usingOptional.map(...).orElse(true).UserService.java:74-105 -
Article.update/User.updateβ three/five independentif (!Util.isEmpty(...))branches each mutatingupdatedAt.Article.java:51-65,User.java:29-49 -
MyBatisArticleRepository.createNewβ iterates tags, find-or-insert each, then inserts relations and article (transaction-sensitive; covered byArticleRepositoryTransactionTest).MyBatisArticleRepository.java:29-41
Coverage notes for the test lead
- Existing tests are strong on happy-path REST endpoints and duplicate/validation errors (
UsersApiTest,ArticlesApiTest,CommentsApiTest). - Weakest coverage: JWT filter header parsing, cursor parsing/limits, idempotent favorite/unfavorite, partial-update slug semantics, and unguarded
Optional.get()inArticleFavoriteApi:36andCommentsApi:50. RealworldApplicationTests.contextLoadsis empty β it only proves the context boots, not behaviour.RealworldApplicationTests.java:9-10