FromElementId extends KorypheFunction<ElementId, Object> { @Override public Object apply(final ElementId e) { if (null == e) { return null; } return e instanceof EntityId ? ((EntityId) e).getVertex() : e; }  @Override Object apply(final ElementId e);  }
@Test public void shouldReturnNullIfTheInputIsNull() { final FromElementId function = new FromElementId(); final Object output = function.apply(null); assertNull(output); }
@Test public void shouldUnwrapIfInputIsAnEntitySeed() { final EntitySeed input = new EntitySeed("item"); final FromElementId function = new FromElementId(); final Object output = function.apply(input); assertSame(input.getVertex(), output); }
@Test public void shouldUnwrapIfInputIsAnEntity() { final Entity input = new Entity("group", "item"); final FromElementId function = new FromElementId(); final Object output = function.apply(input); assertSame(input.getVertex(), output); }
@Test public void shouldReturnOriginalValueIfInputIsAnEdge() { final Edge input = new Edge("group"); final FromElementId function = new FromElementId(); final Object output = function.apply(input); assertSame(input, output); }