### Question:
JsonUtilForPnfCorrelationId { static List<String> parseJsonToGelAllPnfCorrelationId(String json) { if (json == null || json.isEmpty()) { return Collections.emptyList(); } JsonElement je = new JsonParser().parse(json); JsonArray array = je.getAsJsonArray(); List<String> list = new ArrayList<>(); Spliterator<JsonElement> spliterator = array.spliterator(); spliterator.forEachRemaining(jsonElement -> handleEscapedCharacters(jsonElement) .ifPresent(jsonObject -> getPnfCorrelationId(jsonObject) .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId)))); return list; } private  JsonUtilForPnfCorrelationId();   }### Answer:
@Test public void parseJsonSuccessful() { List<String> expectedResult = JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID); assertThat(expectedResult).containsExactly("corrTest1", "corrTest2"); List<String> expectedResult2 = JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(JSON_WITH_ONE_PNF_CORRELATION_ID); assertThat(expectedResult2).containsExactly("corrTest3"); }
@Test public void parseJsonWithEscapeCharacters_Successful() { List<String> expectedResult = JsonUtilForPnfCorrelationId .parseJsonToGelAllPnfCorrelationId(JSON_WITH_TWO_PNF_CORRELATION_ID_AND_ESCAPED_CHARACTERS); assertThat(expectedResult).containsExactly("corrTest4", "corrTest5"); }
@Test public void parseJson_emptyListReturnedWhenNothingFound() { List<String> expectedResult = JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(JSON_WITH_NO_PNF_CORRELATION_ID); assertThat(expectedResult).isEmpty(); }
@Test public void shouldReturnEmptyListWhenInputIsNull() { assertThat(JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(null)).isEmpty(); }
@Test public void shouldReturnEmptyListWhenInputIsEmpty() { assertThat(JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId("")).isEmpty(); }