Skip to content

Conversation

@marko-kriskovic
Copy link
Owner

Summary

Fixed a critical logic error in the JsonMapConverter.mapToJson() method where the null check condition was inverted.

Problem

The method had if (map != null) which caused it to:

  • Throw IllegalArgumentException when a valid (non-null) map was passed
  • Allow null maps to proceed, causing downstream issues

Solution

Changed line 41 from:

if (map != null) {

to:

if (map == null) {

Tests Fixed

This fix resolves all the failing tests mentioned in issue #13:

  • testMapToJson_SimpleMap
  • testMapToJson_NestedMap
  • testMapToJson_EmptyMap
  • testMapToJson_NullInput
  • testRoundTrip_JsonToMapToJson

Fixes #13

Fixed logic error in mapToJson where the null check was inverted.
Changed 'if (map != null)' to 'if (map == null)' to properly
throw IllegalArgumentException when map is null, not when it's valid.

Fixes #13
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.

Padaju testovi

2 participants