### Question:
JsonInstanceInspector implements Inspector { @Override @SuppressWarnings("unchecked") public List<String> getPaths(String kind, String type, String specification, Optional<byte[]> exemplar) { if (specification == null) { return Collections.emptyList(); } String context = null; final List<String> paths = new ArrayList<>(); try { Map<String, Object> json; if (JsonUtils.isJsonArray(specification)) { List<Object> items = JsonUtils.reader().forType(List.class).readValue(specification); paths.addAll(COLLECTION_PATHS); context = ARRAY_CONTEXT; if (items.isEmpty()) { return Collections.unmodifiableList(paths); } json = (Map<String, Object>) items.get(0); } else { json = JsonUtils.reader().forType(Map.class).readValue(specification); } fetchPaths(context, paths, json); } catch (final IOException e) { LOG.warn("Unable to parse the given JSON instance, increase log level to DEBUG to see the instance being parsed"); LOG.debug(specification); LOG.trace("Unable to parse the given JSON instance", e); } return Collections.unmodifiableList(paths); }  @Override @SuppressWarnings("unchecked") List<String> getPaths(String kind, String type, String specification, Optional<byte[]> exemplar); @Override boolean supports(String kind, String type, String specification, Optional<byte[]> optional);  }### Answer:
@Test public void shouldCollectPathsFromJsonObject() { final List<String> paths = inspector.getPaths(JSON_INSTANCE_KIND, "", getJsonInstance(), Optional.empty()); assertProperties(paths); assertThat(paths).doesNotContainAnyElementsOf(JsonInstanceInspector.COLLECTION_PATHS); }
@Test public void shouldCollectPathsFromEmptyJsonObject() { final List<String> paths = inspector.getPaths(JSON_INSTANCE_KIND, "", "{}", Optional.empty()); assertThat(paths).isEmpty(); }
@Test public void shouldCollectPathsFromJsonArray() { final List<String> paths = inspector.getPaths(JSON_INSTANCE_KIND, "", getJsonArrayInstance(), Optional.empty()); assertArrayProperties(paths); assertThat(paths).containsAll(JsonInstanceInspector.COLLECTION_PATHS); }
@Test public void shouldCollectPathsFromEmptyJsonArray() { final List<String> paths = inspector.getPaths(JSON_INSTANCE_KIND, "", "[]", Optional.empty()); assertThat(paths).isEqualTo(JsonInstanceInspector.COLLECTION_PATHS); }