### Question:
CollectionHelper { @SafeVarargs @Nullable public static <T> List<T> toList(@Nullable T... arguments) { if (arguments != null) { if (arguments.length == 1) { return Collections.singletonList(arguments[0]); } if (arguments.length > 1) { return Arrays.asList(arguments); } } return null; }  @SafeVarargs @Nullable static List<T> toList(@Nullable T... arguments); @SuppressWarnings("unchecked") @Nullable static List<Object> toList(@Nullable Collection<T> collection); @Nullable static Set<Long> toSet(@Nullable Collection<Long> collection);  }### Answer:
@Test public void testToListTArray() { assertThat(CollectionHelper.toList()).isNull(); assertThat(CollectionHelper.toList(1)).isInstanceOf(List.class) .containsExactly(1); assertThat(CollectionHelper.toList(1, 2, 3)).isInstanceOf(List.class) .containsExactly(1, 2, 3); }
@Test public void testToListCollectionOfT() { assertThat(CollectionHelper.toList((List<String>) null)).isNull(); assertThat(CollectionHelper.toList(Arrays.asList(1))).isInstanceOf(List.class) .containsExactly(1); assertThat(CollectionHelper.toList(Arrays.asList(1, 2, 3))) .isInstanceOf(List.class).containsExactly(1, 2, 3); Set<Long> set = new HashSet<>(); set.add(11L); set.add(22L); assertThat(CollectionHelper.toList(set)).isInstanceOf(List.class) .containsOnly(11L, 22L); }