GraphConfig { public List<GraphHook> getHooks() { return hooks; } GraphConfig();  GraphConfig(final String graphId); String getGraphId(); void setGraphId(final String graphId); View getView(); void setView(final View view); @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "class") GraphLibrary getLibrary(); void setLibrary(final GraphLibrary library); String getDescription(); void setDescription(final String description); List<GraphHook> getHooks(); void setHooks(final List<GraphHook> hooks); void addHook(final GraphHook hook); @Override String toString();  }
@Test public void shouldJsonDeserialiseFromHookPaths(@TempDir Path tmpDir) throws IOException { final File hook1Path = tmpDir.resolve("hook1Path").toFile(); final File hook2Path = tmpDir.resolve("hook2Path").toFile(); FileUtils.write(hook1Path, "{\"class\": \"" + Log4jLogger.class.getName() + "\"}"); FileUtils.write(hook2Path, "{\"class\": \"" + AddOperationsToChain.class.getName() + "\"}"); final String json = "{" + " \"graphId\": \"graphId1\"," + " \"hooks\": [" + " {" + " \"class\": \"uk.gov.gchq.gaffer.graph.hook.GraphHookPath\"," + " \"path\": \"" + hook1Path.getAbsolutePath() + "\"" + " }, " + " {" + " \"class\": \"uk.gov.gchq.gaffer.graph.hook.GraphHookPath\"," + " \"path\": \"" + hook2Path.getAbsolutePath() + "\"" + " }," + " {" + " \"class\": \"uk.gov.gchq.gaffer.graph.hook.NamedOperationResolver\"" + " }" + " ]" + "}"; final GraphConfig deserialisedObj = fromJson(json.getBytes()); assertNotNull(deserialisedObj); assertEquals(Arrays.asList(Log4jLogger.class, AddOperationsToChain.class, NamedOperationResolver.class), (List) deserialisedObj.getHooks().stream().map(GraphHook::getClass).collect(Collectors.toList())); }