Skip to content

ISSUE-507 # Fallback to NullNode when assertions and verify are null in Step - #816

Merged
authorjapps merged 2 commits into
authorjapps:masterfrom
imsurya26:fix/507-step-assertions-null-safe
Nov 21, 2026
Merged

authorjapps merged 2 commits into
authorjapps:masterfrom
imsurya26:fix/507-step-assertions-null-safe

Conversation

@imsurya26

Copy link
Copy Markdown
Contributor

Fallback to NullNode when assertions and verify are null in Step

Fixed Which Issue?

PR Branch
https://github.com/imsurya26/zerocode/tree/fix/507-step-assertions-null-safe

Motivation and Context

In Jackson 2.13+ / Spring Boot 2.6+, deserializing test scenario steps where both \�ssertions\ and \�erify\ blocks are omitted caused \step.getAssertions()\ to return Java
ull. Downstream processors expecting a non-null \JsonNode\ (e.g., calling .toString()\ or querying nodes) crashed with \NullPointerException.

In \Step.java, the constructor previously used:
\\java
this.assertions = assertions == null || assertions.isNull() ? verify : assertions;
\`nIf \�erify\ was also null, \ his.assertions\ became null.

Solution

Fallback to \NullNode.getInstance()\ if both \�ssertions\ and \�erify\ are null or represent JSON null:
\\java
this.assertions = assertions != null && !assertions.isNull() ? assertions : (verify != null ? verify : NullNode.getInstance());
\`nThis guarantees \getAssertions()\ is never Java
ull, while preserving \isNull() == true\ for JSON null checks.

Checklist:

  • 1. New Unit tests were added (\ estStep_nullAssertionsAndVerify\ in \StepTest.java)
  • 3. Test names are meaningful
  • 4. PR doesn't break any of the earlier features for end users
  • 6.1 I have not added or amended any dependencies in this PR
  • 8. No 'package.*' in the imports
  • 9.1 Not applicable. Internal null-safety fix
  • 10.1 Not applicable. The changes did not affect HTTP automation flow
  • 11.1 Not applicable. The changes did not affect Kafka automation flow

Closes #507

@authorjapps

Copy link
Copy Markdown
Owner

Looks good. 👍
Given a CI run here, once Green, we can merge.

@authorjapps

Copy link
Copy Markdown
Owner

Hello @imsurya26 , have you tested this change locally before pushing your commits?
Just checking, because seems like unit tests are failing here.

Next, can you run locally and fix these, then push the fix?

You can see the failures here in this page as well:

image

Step now falls back to NullNode when both assertions and verify are
missing, so the echo-step early return in compareStepResults must
check isNull() as well as null. Without it, an echo step with no
assertions was compared leniently against "null" and failed.
@imsurya26

Copy link
Copy Markdown
Contributor Author

Thanks for checking, and sorry about that. I had only run StepTest before pushing, not the full core suite.

The failing test was ZeroCodeMultiStepsScenarioRunner_EchoStepTest. Since Step now falls back to NullNode when both assertions and verify are missing, the echo-step early return in compareStepResults no longer matched (it only checked getAssertions() == null). The echo step was then compared leniently against "null" and failed.

c4bd49a fixes it by treating a NullNode the same as a missing value there:

&& (thisStep.getAssertions() == null || thisStep.getAssertions().isNull())

I ran mvn -pl core -am clean test locally. EchoStepTest and StepTest now pass. The only other failures on my machine are Windows-specific (CRLF line endings, absolute paths, source encoding, and the Postgres tests without the docker DB) and are unrelated to this change. On Linux CI only the echo-step test failed before.

@authorjapps

Copy link
Copy Markdown
Owner

sounds good. Given a rerun now

@authorjapps
authorjapps merged commit 43a8245 into authorjapps:master Nov 21, 2026
5 checks passed
@authorjapps

Copy link
Copy Markdown
Owner

CI passed and PR merged

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.

[1.3.28] Step "assertions" field is not null safe

2 participants