ValueUtil { public static List<Object> convertToList(Value value) { Objects.requireNonNull(value, "value is required"); Object val = value.get(); if(val instanceof Iterable) { return getObjects(val); } return Collections.singletonList(getObject(val)); } private  ValueUtil(); static Object convert(Value value); static List<Object> convertToList(Value value);  }
@Test public void shouldConvertList() { Value value = Value.of(10); assertEquals(Collections.singletonList(10), ValueUtil.convertToList(value)); }
@Test public void shouldConvertList2() { Value value = Value.of(Arrays.asList(10, 20)); assertEquals(Arrays.asList(10, 20), ValueUtil.convertToList(value)); }
@Test public void shouldConvertList3() { Value value = Value.of(Arrays.asList(Value.of(10), Value.of(20))); assertEquals(Arrays.asList(10, 20), ValueUtil.convertToList(value)); }