Комплексная проверка JSON с помощью JsonPath

Я пытаюсь проверить ниже JSON с помощью Jsonpath. Я не могу проверить какие-либо значения после "fieldMap". Я не получаю ошибку пути JSON для всего, что я пробовал. Посоветуйте, пожалуйста, как проверить строку json.

{
 "Identifier": "ABC#SOMEYNC001#112#2018071900:00",
  "someEventId": "Some001",
  "Error": null,
  "fieldMap": {
    "responseKey [someType=APPLICANT, somebaseid=982465, somechildid=Some001]": {
      "Gur.CalledFlag": "Y",
      "Some.SomeField01": "null",
      "Some.SomeField02": "null",
      "Some.SomeField03": "null",
      "Some.SomeField04": "null",
     },
    "responseKey [someType=APPLICANT, somebaseid=982455, somechildid=Some001]": {
      "Gur.CalledFlag": "Y",
      "Some.SomeField01": "null",
      "Some.SomeField02": "null",
      "Some.SomeField03": "null",
      "Some.SomeField04": "null",
     }
  },
  "someMap": {
    "982465": {
      "urlMap": "http://someurl.com"
    },
    "982455": {
      "urlMap": "http://someurl.com"
    }
  }
}

И вот как я пытаюсь проверить, в чем я терплю неудачу.

this.mockMvc
.perform(get("/v1.0/someapi/ABC/{SomeEventId}",
        "Some001",
        .andExpect(status().isOk())
        .andExpect(jsonPath("$.Identifier").value(notNullValue()))
        .andExpect(jsonPath("$.someEventId").value("Some001")))
        //.andDo(MockMvcResultHandlers.print())
        .andExpect(jsonPath("Error").value(nullValue()));
        //.andExpect(jsonPath("$.fieldMap").value(nullValue()))
        //.andExpect(jsonPath("$..[Gur.CalledFlag]").value(nullValue()));

Я новичок в этом, любая помощь очень ценится!

0 ответов

Другие вопросы по тегам