@Test
public void testParsingParentAndLeafName() {

    assertEquals(StringUtils.pair("", "$"), JsonUtils.getParentAndLeafPath("$"));
    assertEquals(StringUtils.pair("$", "foo"), JsonUtils.getParentAndLeafPath("$.foo"));
    assertEquals(StringUtils.pair("$", "['foo']"), JsonUtils.getParentAndLeafPath("$['foo']"));
    assertEquals(StringUtils.pair("$.foo", "bar"), JsonUtils.getParentAndLeafPath("$.foo.bar"));
    assertEquals(StringUtils.pair("$.foo", "['bar']"), JsonUtils.getParentAndLeafPath("$.foo['bar']"));
    assertEquals(StringUtils.pair("$.foo", "bar[0]"), JsonUtils.getParentAndLeafPath("$.foo.bar[0]"));
    assertEquals(StringUtils.pair("$.foo", "['bar'][0]"), JsonUtils.getParentAndLeafPath("$.foo['bar'][0]"));
    assertEquals(StringUtils.pair("$.foo[2]", "bar[0]"), JsonUtils.getParentAndLeafPath("$.foo[2].bar[0]"));
    assertEquals(StringUtils.pair("$.foo[2]", "['bar'][0]"), JsonUtils.getParentAndLeafPath("$.foo[2]['bar'][0]"));
    assertEquals(StringUtils.pair("$.foo[2]", "bar"), JsonUtils.getParentAndLeafPath("$.foo[2].bar"));
    assertEquals(StringUtils.pair("$.foo[2]", "['bar']"), JsonUtils.getParentAndLeafPath("$.foo[2]['bar']"));
}