Skip to content

Conversation

@marko-kriskovic
Copy link
Owner

Summary

This PR fixes the failing tests in JsonMapConverterTest by correcting a logic error in the mapToJson method.

Problem

The tests were failing because the null check on line 41 of JsonMapConverter.java was inverted:

  • Before: if (map != null) - This threw an exception when a VALID map was provided
  • After: if (map == null) - This correctly throws an exception when a NULL map is provided

Changes

  • Fixed the condition in mapToJson() method from if (map != null) to if (map == null)

Test Results

This fix addresses all the failing tests mentioned in issue #18:

  • testMapToJson_SimpleMap - Now passes with valid map input
  • testMapToJson_NestedMap - Now passes with valid map input
  • testMapToJson_EmptyMap - Now passes with empty map input
  • testMapToJson_NullInput - Now correctly throws IllegalArgumentException for null input
  • testRoundTrip_JsonToMapToJson - Now completes the round trip successfully

Fixes #18

The condition on line 41 was incorrectly checking if (map != null) when it should check if (map == null). This caused the method to throw an exception when a valid map was provided, instead of when a null map was provided.

Fixes #18
@marko-kriskovic
Copy link
Owner Author

Please fill the body of the Pull Request

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.

Testovi padaju, ne znam zašto

2 participants