@Test public void testEndObject() throws Exception { JacksonParserWrapper parser = new JacksonParserWrapper(jsonFactory.createJsonParser("{}")); parser.startObject(); parser.endObject(); try { parser.endObject(); fail("Where is the Exception"); } catch (JsonParseException e) { assertThat(e.getMessage()).startsWith("Invalid token. Expected <END_OBJECT> but got <null>"); } }
@Test public void testSimple() throws Exception { JacksonParserWrapper parser = new JacksonParserWrapper( jsonFactory.createJsonParser(getClass().getResource("simple.json"))); parser.startObject(); parser.nextFieldValue("street"); assertThat(parser.getText()).isEqualTo("Schlossalle"); parser.nextFieldValue("number"); assertThat(parser.getIntValue()).isEqualTo(7); parser.endObject(); }