Example usage for com.fasterxml.jackson.core JsonParser nextTextValue

List of usage examples for com.fasterxml.jackson.core JsonParser nextTextValue

Introduction

In this page you can find the example usage for com.fasterxml.jackson.core JsonParser nextTextValue.

Prototype

public String nextTextValue() throws IOException, JsonParseException 

Source Link

Document

Method that fetches next token (as if calling #nextToken ) and if it is JsonToken#VALUE_STRING returns contained String value; otherwise returns null.

Usage

From source file:ren.hankai.cordwood.jackson.DateTimeDeserializerTest.java

@Test
public void testDeserializeInvalidDate() throws Exception {
    final ObjectMapper om = new ObjectMapper();
    final DateTimeDeserializer des = new DateTimeDeserializer();
    final JsonParser jp = om.getFactory().createParser("{\"date\": \"20180901 13:23|12\"}");

    String val = null;
    do {//from   ww  w  .j  av  a  2s.  c om
        val = jp.nextTextValue();
    } while (val == null);

    final Date date = des.deserialize(jp, om.getDeserializationContext());
    Assert.assertNull(date);
}