UnwrapEntityId extends KorypheFunction<Object, Object> { @Override public Object apply(final Object item) { return null != item ? item instanceof EntityId ? ((EntityId) item).getVertex() : item : null; }  @Override Object apply(final Object item);  }
@Test public void shouldReturnNullForNullValue() { final UnwrapEntityId function = new UnwrapEntityId(); final Object result = function.apply(null); assertNull(result); }
@Test public void shouldReturnOriginalValueForEdgeIds() { final EdgeId value = mock(EdgeId.class); final UnwrapEntityId function = new UnwrapEntityId(); final Object result = function.apply(value); assertSame(value, result); }
@Test public void shouldUnwrapEntityIds() { final EntityId value = mock(EntityId.class); final Object vertex = mock(Object.class); given(value.getVertex()).willReturn(vertex); final UnwrapEntityId function = new UnwrapEntityId(); final Object result = function.apply(value); assertSame(vertex, result); }