### Question:
PayloadDeserializer extends StdDeserializer<Payload> { String getString(Map<String, JsonNode> tree, String claimName) { JsonNode node = tree.get(claimName); if (node == null || node.isNull()) { return null; } return node.asText(null); } PayloadDeserializer(ObjectReader reader); private  PayloadDeserializer(Class<?> vc, ObjectReader reader); @Override Payload deserialize(JsonParser p, DeserializationContext ctxt);  }### Answer:
@Test public void shouldGetNullStringWhenParsingNullNode() throws Exception { Map<String, JsonNode> tree = new HashMap<>(); NullNode node = NullNode.getInstance(); tree.put("key", node); String text = deserializer.getString(tree, "key"); assertThat(text, is(nullValue())); }
@Test public void shouldGetNullStringWhenParsingNull() throws Exception { Map<String, JsonNode> tree = new HashMap<>(); tree.put("key", null); String text = deserializer.getString(tree, "key"); assertThat(text, is(nullValue())); }
@Test public void shouldGetStringWhenParsingTextNode() throws Exception { Map<String, JsonNode> tree = new HashMap<>(); TextNode node = new TextNode("something here"); tree.put("key", node); String text = deserializer.getString(tree, "key"); assertThat(text, is(notNullValue())); assertThat(text, is("something here")); }