Skip to content

Add Unit Tests across Bengen-API - #70

Open
vanitha1822 wants to merge 8 commits into
release-3.8.2from
nd/vs/test_coverage
Open

Add Unit Tests across Bengen-API#70
vanitha1822 wants to merge 8 commits into
release-3.8.2from
nd/vs/test_coverage

Conversation

@vanitha1822

Copy link
Copy Markdown
Member

📋 Description

JIRA ID:

NA


✅ Type of Change

  • 🧪 Tests (adding new or updating existing tests)

ℹ️ Additional Information

image

vanitha1822 and others added 8 commits August 21, 2026 11:18
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>
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 85efe10c-dd62-4fec-9005-0fa806793dfb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vanitha1822 vanitha1822 self-assigned this Aug 21, 2026
@vanitha1822
vanitha1822 requested a review from drtechie August 21, 2026 09:49
@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants