• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.fasterxml.jackson.databind.node;
2 
3 import java.io.IOException;
4 
5 import com.fasterxml.jackson.core.*;
6 import com.fasterxml.jackson.core.io.JsonEOFException;
7 import com.fasterxml.jackson.databind.*;
8 
9 public class TreeFromIncompleteJsonTest extends BaseMapTest
10 {
11     final private ObjectMapper MAPPER = objectMapper(); // shared is fine
12 
testErrorHandling()13     public void testErrorHandling() throws IOException {
14 
15       String json = "{\"A\":{\"B\":\n";
16       JsonParser parser = MAPPER.createParser(json);
17       try {
18           parser.readValueAsTree();
19       } catch (JsonEOFException e) {
20           verifyException(e, "Unexpected end-of-input");
21       }
22       parser.close();
23 
24       try {
25           MAPPER.readTree(json);
26       } catch (JsonEOFException e) {
27           verifyException(e, "Unexpected end-of-input");
28       }
29 
30       try {
31           MAPPER.reader().readTree(json);
32       } catch (JsonEOFException e) {
33           verifyException(e, "Unexpected end-of-input");
34       }
35     }
36 }
37