package test; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.guidewire.appevents.event.test.Json; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertThrows; class LeniencyTest { @Test void shouldThrowWhenNotLenient() { var node = JsonNodeFactory.instance.objectNode().set("date", Json.fromString("402")); var objectMapper = new ObjectMapper().registerModule(new JavaTimeModule()); assertThrows(JsonMappingException.class, () -> objectMapper.convertValue(node, POJO.class)); } }