@Test public void shouldGetIdsInCommaSeparatedForm() { List<BaseModel> models = new ArrayList<>(); models.add(model(1L)); models.add(model(2L)); CommaSeparator commaSeparator = new CommaSeparator(); String result = commaSeparator.commaSeparateIds(models); assertThat(result, is("{1, 2}")); }
public String commaSeparateIds(List<T> list) { List<Long> ids = new ArrayList<>(); for (T t : list) { ids.add(t.getId()); } return ids.toString().replace("[", "{").replace("]", "}"); }
CommaSeparator { public String commaSeparateIds(List<T> list) { List<Long> ids = new ArrayList<>(); for (T t : list) { ids.add(t.getId()); } return ids.toString().replace("[", "{").replace("]", "}"); } }
CommaSeparator { public String commaSeparateIds(List<T> list) { List<Long> ids = new ArrayList<>(); for (T t : list) { ids.add(t.getId()); } return ids.toString().replace("[", "{").replace("]", "}"); }  }
CommaSeparator { public String commaSeparateIds(List<T> list) { List<Long> ids = new ArrayList<>(); for (T t : list) { ids.add(t.getId()); } return ids.toString().replace("[", "{").replace("]", "}"); }  String commaSeparateIds(List<T> list); }
CommaSeparator { public String commaSeparateIds(List<T> list) { List<Long> ids = new ArrayList<>(); for (T t : list) { ids.add(t.getId()); } return ids.toString().replace("[", "{").replace("]", "}"); }  String commaSeparateIds(List<T> list);  }