@Test
    public void testKeyParsing() {
        assertEquals(new FieldPathEntry.KeyParseResult("", 2), FieldPathEntry.parseKey("{}"));
        assertEquals(new FieldPathEntry.KeyParseResult("abc", 5), FieldPathEntry.parseKey("{abc}"));
        assertEquals(new FieldPathEntry.KeyParseResult("abc", 8), FieldPathEntry.parseKey("{   abc}"));
        // TODO: post-skipping of spaces not supported for verbatim keys in C++. support here?
        //assertEquals(new FieldPathEntry.KeyParseResult("abc", 8), FieldPathEntry.parseKey("{abc   }"));
        assertEquals(new FieldPathEntry.KeyParseResult("hello", 9), FieldPathEntry.parseKey("{\"hello\"}"));
        assertEquals(new FieldPathEntry.KeyParseResult("{abc}", 9), FieldPathEntry.parseKey("{\"{abc}\"}"));
        assertEquals(new FieldPathEntry.KeyParseResult("abc", 5), FieldPathEntry.parseKey("{abc}stuff"));
        assertEquals(new FieldPathEntry.KeyParseResult("abc", 10), FieldPathEntry.parseKey("{   \"abc\"}"));
        assertEquals(new FieldPathEntry.KeyParseResult("abc", 10), FieldPathEntry.parseKey("{\"abc\"   }"));
        assertEquals(new FieldPathEntry.KeyParseResult("abc", 13), FieldPathEntry.parseKey("{   \"abc\"   }"));
        // Test quote escaping
        assertEquals(new FieldPathEntry.KeyParseResult("\"doom house\"", 18), FieldPathEntry.parseKey("{\"\\\"doom house\\\"\"}"));
        assertEquals(new FieldPathEntry.KeyParseResult("\"", 6), FieldPathEntry.parseKey("{\"\\\"\"}"));
        assertEquals(new FieldPathEntry.KeyParseResult("a\"b\"c", 11), FieldPathEntry.parseKey("{\"a\\\"b\\\"c\"}"));
        // Test failure conditions
        try {
            FieldPathEntry.parseKey("");
            fail();
        } catch (IllegalArgumentException e) {
            assertEquals("Key '' does not start with '{'", e.getMessage());
        }

        try {
            FieldPathEntry.parseKey("{");
            fail();
        } catch (IllegalArgumentException e) {
            assertEquals("Key '{' is incomplete. No matching '}'", e.getMessage());
        }

        try {
            FieldPathEntry.parseKey("{aaa");
            fail();
        } catch (IllegalArgumentException e) {
            assertEquals("Key '{aaa' is incomplete. No matching '}'", e.getMessage());
        }

        try {
            FieldPathEntry.parseKey("{\"things}");
            fail();
        } catch (IllegalArgumentException e) {
            assertEquals("Escaped key '{\"things}' is incomplete. No matching '\"'", e.getMessage());
        }

        try {
            FieldPathEntry.parseKey("{\"things\\}");
            fail();
        } catch (IllegalArgumentException e) {
            assertEquals("Escaped key '{\"things\\}' has bad quote character escape sequence. Expected '\"'", e.getMessage());
        }
    }
Tests applying and serializing document updates.

@author Einar M R Rosenvinge
document/src/test/java/com/yahoo/document/DocumentPathUpdateTestCase.java