Skip to content

Refactor ScriptingUtilsTest to include value assertions for JSON deserialization#2957

Merged
predic8 merged 2 commits into
masterfrom
enhance-scriptin-utils
May 27, 2026
Merged

Refactor ScriptingUtilsTest to include value assertions for JSON deserialization#2957
predic8 merged 2 commits into
masterfrom
enhance-scriptin-utils

Conversation

@christiangoerdes
Copy link
Copy Markdown
Collaborator

@christiangoerdes christiangoerdes commented May 27, 2026

Summary by CodeRabbit

  • Tests
    • Tightened JSON scripting bindings tests to assert concrete parsed values for maps, arrays, strings, and numbers (including a specific numeric equality check).
    • Improved test clarity and formatting.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 058f3af2-f7b0-453b-975a-f876ecf714c1

📥 Commits

Reviewing files that changed from the base of the PR and between b9906dd and 5b33a9c.

📒 Files selected for processing (1)
  • core/src/test/java/com/predic8/membrane/core/lang/ScriptingUtilsTest.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • core/src/test/java/com/predic8/membrane/core/lang/ScriptingUtilsTest.java

📝 Walkthrough

Walkthrough

This PR tightens tests in ScriptingUtilsTest: adds a static assertEquals import and updates map, array, string, and number JSON tests to assert concrete parsed values in addition to type checks.

Changes

JSON Binding Test Assertions

Layer / File(s) Summary
Enhanced JSON binding test assertions
core/src/test/java/com/predic8/membrane/core/lang/ScriptingUtilsTest.java
Adds assertEquals static import; updates map, array, and string tests to assert concrete parsed values (Map.of(...), List.of(...), "foo"); number test now asserts parsed integer equals 7; adjusts closing brace whitespace.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • membrane/api-gateway#2956: Updates to JSON binding test assertions directly correspond to changes in ScriptingUtils.createParameterBindings JSON deserialization behavior.

Suggested reviewers

  • rrayst

Poem

🐰 Tests now check not just what things are,
But what they hold—assertions raised the bar!
assertEquals hops in to confirm the core,
Maps, lists, strings, and numbers—now checked once more.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: refactoring ScriptingUtilsTest to add value assertions for JSON deserialization tests, which directly reflects the actual changes made to the test file.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch enhance-scriptin-utils

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.

@christiangoerdes christiangoerdes linked an issue May 27, 2026 that may be closed by this pull request
@christiangoerdes
Copy link
Copy Markdown
Collaborator Author

/ok-to-test

Copy link
Copy Markdown
Contributor

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@core/src/test/java/com/predic8/membrane/core/lang/ScriptingUtilsTest.java`:
- Around line 52-55: The number() test in ScriptingUtilsTest currently only
asserts the type returned by createBinding("7").get("json"); update the test to
also assert the actual numeric value for consistency — call
createBinding("7").get("json") and add an assertEquals(Integer.valueOf(7), ...)
(or simply assertEquals(7, ((Integer) ...).intValue())) alongside the existing
assertInstanceOf to verify the value is 7; locate this in the ScriptingUtilsTest
class and modify the number() test that references createBinding and the "json"
key.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b422d03e-1394-4246-be6e-930fe8d1fd18

📥 Commits

Reviewing files that changed from the base of the PR and between 87dd5e9 and b9906dd.

📒 Files selected for processing (1)
  • core/src/test/java/com/predic8/membrane/core/lang/ScriptingUtilsTest.java

Comment thread core/src/test/java/com/predic8/membrane/core/lang/ScriptingUtilsTest.java Outdated
@membrane-ci-server
Copy link
Copy Markdown

This pull request needs "/ok-to-test" from an authorized committer.

@predic8 predic8 merged commit 37eff25 into master May 27, 2026
4 of 5 checks passed
@predic8 predic8 deleted the enhance-scriptin-utils branch May 27, 2026 07:42
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.

ScriptingUtils: Breaks if Payload is JSON Array

2 participants