@Test public void readLayerFile() throws Exception { assertEquals("layers", readFileAsJSON("/json/layers/layer.json").optString("name")); assertEquals("root", readFileAsJSON("/test.json").optString("name")); JSONObject layer = readFileAsJSON("layer.json"); assertEquals("layers", layer.optString("name")); }
protected static String readLayerFile(final String file) { String json = getPaths(file).stream() .map(filename -> tryResource(filename)) .filter(j -> j != null && !j.isEmpty()) .findFirst() .orElse(null); if (json == null) { throw new OskariRuntimeException("Couldn't locate layer JSON for " + file); } return json; }
LayerHelper { protected static String readLayerFile(final String file) { String json = getPaths(file).stream() .map(filename -> tryResource(filename)) .filter(j -> j != null && !j.isEmpty()) .findFirst() .orElse(null); if (json == null) { throw new OskariRuntimeException("Couldn't locate layer JSON for " + file); } return json; } }
LayerHelper { protected static String readLayerFile(final String file) { String json = getPaths(file).stream() .map(filename -> tryResource(filename)) .filter(j -> j != null && !j.isEmpty()) .findFirst() .orElse(null); if (json == null) { throw new OskariRuntimeException("Couldn't locate layer JSON for " + file); } return json; }  }
LayerHelper { protected static String readLayerFile(final String file) { String json = getPaths(file).stream() .map(filename -> tryResource(filename)) .filter(j -> j != null && !j.isEmpty()) .findFirst() .orElse(null); if (json == null) { throw new OskariRuntimeException("Couldn't locate layer JSON for " + file); } return json; }  static int setupLayer(final String layerfile); }
LayerHelper { protected static String readLayerFile(final String file) { String json = getPaths(file).stream() .map(filename -> tryResource(filename)) .filter(j -> j != null && !j.isEmpty()) .findFirst() .orElse(null); if (json == null) { throw new OskariRuntimeException("Couldn't locate layer JSON for " + file); } return json; }  static int setupLayer(final String layerfile);  }