Skip to content

Conversation

@marko-kriskovic
Copy link
Owner

Summary

This PR fixes the failing JUnit tests in JsonMapConverterTest by correcting an inverted null check condition in the mapToJson method.

Problem

The mapToJson method in JsonMapConverter.java had a logic error on line 42:

if (map != null) {
    throw new IllegalArgumentException("Map cannot be null");
}

This condition was backwards - it was throwing an exception when the map was not null, which caused all tests that passed valid maps to fail.

Solution

Changed the condition to correctly check for null:

if (map == null) {
    throw new IllegalArgumentException("Map cannot be null");
}

Tests Affected

This fix resolves the following failing tests:

  • testMapToJson_SimpleMap
  • testMapToJson_NestedMap
  • testMapToJson_EmptyMap
  • testMapToJson_NullInput
  • testRoundTrip_JsonToMapToJson

All tests should now pass successfully.

Fixes #30

The mapToJson method had an inverted null check condition.
It was throwing an exception when map != null, but it should
throw when map == null. This was causing all tests to fail.

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

the tests are failing, please fix

2 participants