ExtractGroup extends KorypheFunction<Element, String> { @Override public String apply(final Element element) { return null != element ? element.getGroup() : null; }  @Override String apply(final Element element);  }
@Test public void shouldReturnGroupFromEdge() { final ExtractGroup function = new ExtractGroup(); final String group = "testGroup"; final Edge edge = new Edge.Builder() .source("src") .dest("dest") .directed(true) .group(group) .build(); final String result = function.apply(edge); assertEquals(group, result); }
@Test public void shouldReturnGroupFromEntity() { final ExtractGroup function = new ExtractGroup(); final String group = "testGroup_2"; final Entity entity = new Entity.Builder() .vertex("1") .group(group) .build(); final String result = function.apply(entity); assertEquals(group, result); }
@Test public void shouldReturnNullForNullElement() { final ExtractGroup function = new ExtractGroup(); final String result = function.apply(null); assertNull(result); }