Skip to content

Conversation

@marko-kriskovic
Copy link
Owner

Summary

This PR fixes the inverted null check condition in the JsonMapConverter.mapToJson() method that was causing all tests to fail.

Problem

The null check on line 40 was incorrectly checking if (map != null) and throwing an exception when a non-null map was passed. This caused the method to:

  • Throw exceptions for all valid map inputs
  • NOT throw an exception when null was passed (opposite of intended behavior)

Solution

Changed the condition from if (map != null) to if (map == null) on line 40.

Tests Fixed

This fixes all failing tests in JsonMapConverterTest:

  • testMapToJson_SimpleMap
  • testMapToJson_NestedMap
  • testMapToJson_EmptyMap
  • testMapToJson_NullInput
  • testRoundTrip_JsonToMapToJson

Closes #7

The null check condition was inverted - it was throwing an exception
when the map was NOT null instead of when it WAS null. Changed the
condition from "if (map != null)" to "if (map == null)" on line 40.

This fixes all failing tests in JsonMapConverterTest:
- testMapToJson_SimpleMap
- testMapToJson_NestedMap  
- testMapToJson_EmptyMap
- testMapToJson_NullInput
- testRoundTrip_JsonToMapToJson

Resolves #7
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