Skip to content

Conversation

@SradhaMohanty5899
Copy link
Contributor

@SradhaMohanty5899 SradhaMohanty5899 commented Dec 23, 2025

Handled ISO local date-time values (without timezone) for PMS date filters by safely converting them to yyyy-MM-dd during ID replacement. This fixes DateTimeParseException and ensures valid request JSON without impacting other test cases or common framework logic.

Summary by CodeRabbit

  • Bug Fixes

    • Improved date property handling in API testing utilities to correctly parse and substitute date-related ID fields with cached values in the expected format (yyyy-MM-dd).
  • Chores

    • Minor code formatting adjustments.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>
Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>
@coderabbitai
Copy link

coderabbitai bot commented Dec 23, 2025

Walkthrough

The AdminTestUtil class now processes date-related ID properties (sbiExpiryDateTime, sbiCreatedDateTime) by fetching values from cache, parsing date formats, and substituting them into JSON via corresponding keywords, enhancing date normalization for ID-related fields.

Changes

Cohort / File(s) Summary
Date-aware ID property handling
apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java
Enhanced replaceIdWithAutogeneratedId method to detect and process date-related properties (sbiExpiryDateTime, sbiCreatedDateTime). Adds logic to fetch values from cache, parse dates (yyyy-MM-dd format when time components present), and substitute into JSON via keyword matching. Minor formatting: removed empty line.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A date-handling hop, through cache we seek,
Parse those timestamps, not too sleek,
sbiExpiry and Creation align,
JSON substitution—oh so fine!
Normalization's dance, precise and neat!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly matches the main change: handling ISO local date-time values and normalizing them to yyyy-MM-dd format for PMS date filters, which is the core objective described in the PR description.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.40.3)
apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java (1)

4417-4455: PMS date-time normalization is correct; consider tightening control flow to avoid double replacement

The new branch correctly special-cases PMS IDs by:

  • pulling the cached value,
  • trimming it down to a date-only string when it contains a T, and
  • falling back to the original value with just a warning if parsing fails.

Because execution then falls through into the existing if (keyForIdProperty.contains("time_slot_from")) { ... } else { ... } block, replaceKeywordWithValue is invoked a second time for these PMS keys (using the raw cached value). That second call is effectively a no-op on the JSON string (the placeholder is already gone) but does extra work and mutates the consumers map again.

You could make the intent clearer and avoid redundant work by short‑circuiting for these PMS keys, e.g.:

  • return immediately after the PMS-specific replacement, or
  • restructure this area into an if ... else if (sbi* ...) ... else if (time_slot_from ...) ... else ... chain.

Behavior stays the same, but the code path is easier to reason about and avoids double bookkeeping on the consumers map.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a09d66 and a8817a2.

📒 Files selected for processing (1)
  • apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-maven-apitest-commons / maven-build
  • GitHub Check: Analyze (java-kotlin)

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