### Question:
ShardingItems { public static List<Integer> toItemList(final String itemsString) { if (Strings.isNullOrEmpty(itemsString)) { return Collections.emptyList(); } String[] items = itemsString.split(DELIMITER); List<Integer> result = new ArrayList<>(items.length); for (String each : items) { int item = Integer.parseInt(each); if (!result.contains(item)) { result.add(item); } } return result; }  static List<Integer> toItemList(final String itemsString); static String toItemsString(final List<Integer> items);  }### Answer:
@Test public void assertTtoItemListWhenNull() { assertThat(ShardingItems.toItemList(null), is(Collections.EMPTY_LIST)); }
@Test public void assertToItemListWhenEmpty() { assertThat(ShardingItems.toItemList(""), is(Collections.EMPTY_LIST)); }
@Test public void assertToItemList() { assertThat(ShardingItems.toItemList("0,1,2"), is(Arrays.asList(0, 1, 2))); }
@Test public void assertToItemListForDuplicated() { assertThat(ShardingItems.toItemList("0,1,2,2"), is(Arrays.asList(0, 1, 2))); }