Add Unit Tests across Bengen-API - #70
Conversation
The controller returns a LinkedHashMap of buildTimestamp/version/branch/ commitHash, but the test still asserted the old OutputResponse wrapper. Assert the four fields against git.properties on the classpath instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adds unit tests for the health check aggregation (UP/DEGRADED/DOWN rollup, Redis PING handling, Redis-not-configured skip, beneficiary ID pool threshold warning and count throttling, executor lifecycle) and for the controller's 200-vs-503 mapping. Line coverage: 28.3% -> 43.1% Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…Response - JwtUserIdValidationFilter: origin allow-list and CORS preflight, public endpoint bypass, cookie/header token paths, mobile (okhttp, java/) client handling with User-Agent context cleanup, userId cookie expiry. - HTTPRequestInterceptor: Authorization skip, whitelisted APIs, forwarded client address preference, error payload and conditional CORS headers, postHandle session refresh and failure swallowing. - utils/response/OutputResponse: defaults, JSON object/array/plain payload handling, and the full throwable-to-status-code mapping. Line coverage: 43.1% -> 59.0% (146 tests) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tResponse.Builder - JwtAuthenticationUtil: cookie token validation responses, Redis cache hit, DB fallback with 30-minute re-cache, and the rejection paths for invalid tokens, unknown users, non-numeric ids and a Redis outage. - ConfigProperties: typed property accessors and their non-numeric fallbacks, session/redis accessors, plain and Base64-tagged passwords. - HttpUtils: GET/POST bodies and status recording, Authorization and Content-Type header forwarding, default JSON content type. - utils/OutputResponse.Builder: fluent assembly, chaining, JSON shape and the throwable-to-status-code mapping. Line coverage: 59.0% -> 68.7% (199 tests) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…list, SessionObject - RedisStorage: set/get/update/delete against a mocked Lettuce connection, including the write-only-when-absent rule and the missing-session RedisSessionException paths. - GenericEmailServiceImpl: message assembly from the JSON request, semicolon recipient splitting, missing-field and transport failures. - JwtUtil: real HS256 tokens for the valid, denylisted, foreign-secret, expired, malformed and unconfigured-secret cases plus claim extraction. - TokenDenylist: prefixed key with expiry, jti and expiry guards, Redis failure surfacing on write and fail-open behaviour on read. - SessionObject: delegation to the store with configured expiry settings and propagation of store failures. Line coverage: 68.7% -> 77.0% (247 tests) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… Hikari diagnostics - HealthService: HikariCP pool-exhaustion detection via a mocked HikariDataSource and HikariPoolMXBean, the missing-MXBean and failed diagnostic-query paths, and the aggregate timeout that marks a component DOWN when its check never completes. - QuartzConfig: job, cron trigger (default vs configured schedule), scheduler and quartz-properties beans called directly. - AutowiringSpringBeanJobFactory: job instances autowired from the application context. - BeneficiaryId: field round-tripping and Lombok value semantics. - RestTemplateUtil: header assembly with and without a bound request, JwtToken header/cookie replay, mobile User-Agent propagation. - Generator: digit counting, random helpers, diagnostics. Note: Generator computes the Verhoeff digit over the 12-digit base while its final position is still zero, rather than over the 11-digit prefix, so generated ids do not satisfy a standard Verhoeff validation. The test pins the invariant the code actually guarantees and documents this. Line coverage: 77.0% -> 86.0% (329 tests) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…% coverage - CorsConfig, SwaggerConfig, RedisConfig, InterceptorConfig, FilterConfig and IEMRApplBeans: @Bean/override methods called directly, asserting on the registrations and objects they return. - AuthorizationHeaderRequestWrapper: overridden header accessors, case-insensitive matching, pass-through and no-duplicate header names. - IEMRException and InventoryException: message and cause constructors, including the adopted stack trace and deliberately unchained cause. - M_BeneficiaryRegidMapping: construction, value semantics and the Gson toString that exposes only annotated fields. - UserAgentContext: thread-confinement of the per-request User-Agent. Line coverage: 86.0% -> 92.2% (1392/1510 lines, 380 tests) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The report's headline column is instruction coverage, which read 89% even though line coverage was 92%. This closes the gaps on all five metrics. - User: field access and full value semantics (was 0% branch coverage). - BeneficiaryId, M_BeneficiaryRegidMapping: one variant per field so every Lombok-generated equality branch runs, including the null-on-both-sides and symmetry cases, plus hashCode tolerance of nulls. - utils/OutputResponse: value semantics and payload replacement. - OutputResponse.Builder and utils/response/OutputResponse: the switch arms for exception types owned by other AMRIT modules (MissingMandatoryFields, IllegalAction, JDBC, SQLGrammar, ConstraintViolation), reached via test-local types since the mapping switches on getSimpleName(). - Verhoeff: generate/validate round-trip, wrong check digit and adjacent transposition, the error the algorithm exists to catch. - BeneficiaryGenApplication and CommonMain: bean methods and the WAR configure() hook called directly. Instruction 89.9% -> 96.3%, branch 69.8% -> 91.6%, line 91.9% -> 94.2%, method 89.0% -> 95.8%, class 88.5% -> 92.3% (424 tests) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|



📋 Description
JIRA ID:
NA
✅ Type of Change
ℹ️ Additional Information