Category { public static Category of(String name, Group... groups) { return Category.of(name, ImmutableList.copyOf(groups)); } private  Category(String name, ImmutableList<Category> subcategories, ImmutableList<Group> groups); static Category of(String name, Group... groups); static Category of(String name, Collection<Group> groups); static Category of(String name, Collection<Category> subcategories, Collection<Group> groups); String getName(); ImmutableList<Category> getSubcategories(); ImmutableList<Group> getGroups();  }
@Test public void testInvalidNames() { assertAll( () -> assertThrows(NullPointerException.class, () -> Category.of(null)), () -> assertThrows(IllegalArgumentException.class, () -> Category.of("")), () -> assertThrows(IllegalArgumentException.class, () -> Category.of(" ")), () -> assertThrows(IllegalArgumentException.class, () -> Category.of("\n")), () -> assertThrows(IllegalArgumentException.class, () -> Category.of("\t")) ); }