OperationUtil { public static Iterable<?> fromElementIds(final Iterable<? extends ElementId> input) { if (null == input) { return null; } return IterableUtil.map(input, new FromElementId()); } private  OperationUtil(); static Iterable<? extends ElementId> toElementIds(final Object... input); static Iterable<? extends ElementId> toElementIds(final Iterable<?> input); static Iterable<?> fromElementIds(final Iterable<? extends ElementId> input); static Iterable<? extends EntityId> toEntityIds(final Object... input); static Iterable<? extends EntityId> toEntityIds(final Iterable<?> input); static Iterable<?> fromEntityIds(final Iterable<? extends EntityId> input); static Operation extractNextOp(final Iterator<Operation> itr);  }
@Test public void shouldReturnNullIfConvertFromElementIdsWithNullInput() { assertNull(OperationUtil.fromElementIds(null)); }
@Test public void shouldConvertFromElementIds() { final Iterable<ElementId> input = Arrays.asList( new EntitySeed(1), new EntitySeed("2"), new EntitySeed("3"), new Entity("group", "4"), new EdgeSeed("5", 6), new Edge("group", 7L, 8, true), null ); final Iterable<?> output = OperationUtil.fromElementIds(input); final ArrayList<Serializable> expected = Lists.newArrayList( 1, "2", "3", "4", new EdgeSeed("5", 6), new Edge("group", 7L, 8, true), null ); assertEquals(expected, Lists.newArrayList(output)); }
@Test public void shouldConvertFromEntityIds() { final Iterable<ElementId> input = Arrays.asList( new EntitySeed(1), new EntitySeed("2"), new EntitySeed("3"), new Entity("group", "4"), null ); final Iterable<?> output = OperationUtil.fromElementIds(input); final ArrayList<? extends Serializable> expected = Lists.newArrayList( 1, "2", "3", "4", null ); assertEquals(expected, Lists.newArrayList(output)); }