Add boundary tests for JsonTreeWriter.endArray() error handling#2988
Add boundary tests for JsonTreeWriter.endArray() error handling#2988eamonnmcmanus merged 3 commits intogoogle:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
eamonnmcmanus
left a comment
There was a problem hiding this comment.
This seems like a reasonable change. Just one question.
|
Could you please move your last commit (073d0f5) to a separate PR? It is unrelated to |
Sorry about that, and thank you for catching it. |
eamonnmcmanus
left a comment
There was a problem hiding this comment.
Thanks, it's good to check these extra cases.
Summary
Add 3 boundary tests for
JsonTreeWriter.endArray()to verify proper exception throwing when called in invalid states:testEndArrayOnEmptyStackThrows- Verifies IllegalStateException when calling endArray() on empty stacktestEndArrayWithPendingNameThrows- Verifies IllegalStateException when a pending name exists (object not closed)testEndArrayWhenStackTopIsNotArrayThrows- Verifies IllegalStateException when stack top is an object, not an arrayWhy
Current tests cover:
However, they don't explicitly test
endArray()error conditions for invalid state detection. These boundary cases ensure proper state validation and prevent regressions from state management changes.Verification
mvn -Dtest=JsonTreeWriterTest test
Result: Tests run: 25, Failures: 0, Errors: 0, Skipped: 0 - BUILD SUCCESS