Skip to content

Commit

Permalink
feat: deserialize methods with defaultValue parameter (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
grigoriev authored Sep 9, 2024
1 parent 0ec385a commit 3c8f10f
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,24 @@ void testDeserializeNull() {
Object deserializedObject = model.deserializeEntry(TEST_STRING, null, Object.class);
Assertions.assertNull(deserializedObject);
}

@Test
void testDeserializeEmptyString() {
Object deserializedObject = model.deserializeEntry(TEST_STRING, "", Object.class);
Assertions.assertNull(deserializedObject);
}

@Test
void testDeserializeEmptyEntryWithDefaultStringValue() {
String deserializedString = model.deserializeEntry(TEST_OBJECT, null, String.class, "defaultValue");
Assertions.assertEquals("defaultValue", deserializedString);
}


@Test
void testDeserializeEmptyEntryWithDefaultObjectValue() {
TestObject defaultValue = new TestObject("testKey", 1);
final TestObject deserializedObject = model.deserializeEntry(TEST_OBJECT, null, TestObject.class, defaultValue);
Assertions.assertEquals(defaultValue, deserializedObject);
}
}

0 comments on commit 3c8f10f

Please sign in to comment.