GraphConfig { public View getView() { return null != view ? View.fromJson(view) : null; } 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 shouldReturnClonedView() throws Exception { final String graphId = "graphId"; final View view = new View.Builder().entity(TestGroups.ENTITY).build(); final GraphConfig config = new GraphConfig.Builder() .graphId(graphId) .view(view) .build(); assertEquals(view, config.getView()); assertNotSame(view, config.getView()); }