GenericItem implements ActiveItem { @Override public void addGroupName(String groupItemName) { if (groupItemName == null) { throw new IllegalArgumentException("Group item name must not be null!"); } if (!groupNames.contains(groupItemName)) { groupNames.add(groupItemName); } } GenericItem(String type, String name); @Override State getState(); @Override T getStateAs(Class<T> typeClass); @Override String getUID(); @Override String getName(); @Override String getType(); @Override List<String> getGroupNames(); @Override void addGroupName(String groupItemName); @Override void addGroupNames(String... groupItemNames); @Override void addGroupNames(List<String> groupItemNames); @Override void removeGroupName(String groupItemName); void dispose(); void setEventPublisher(@Nullable EventPublisher eventPublisher); void setStateDescriptionService(@Nullable StateDescriptionService stateDescriptionService); void setCommandDescriptionService(@Nullable CommandDescriptionService commandDescriptionService); void setUnitProvider(@Nullable UnitProvider unitProvider); void setItemStateConverter(@Nullable ItemStateConverter itemStateConverter); void setState(State state); void send(RefreshType command); @Override String toString(); void addStateChangeListener(StateChangeListener listener); void removeStateChangeListener(StateChangeListener listener); @Override int hashCode(); @Override boolean equals(@Nullable Object obj); @Override Set<String> getTags(); @Override boolean hasTag(String tag); @Override void addTag(String tag); @Override void addTags(Collection<String> tags); @Override void addTags(String... tags); @Override void removeTag(String tag); @Override void removeAllTags(); @Override @Nullable String getLabel(); @Override void setLabel(@Nullable String label); @Override @Nullable String getCategory(); @Override void setCategory(@Nullable String category); @Override @Nullable StateDescription getStateDescription(); @Override @Nullable StateDescription getStateDescription(@Nullable Locale locale); @Override @Nullable CommandDescription getCommandDescription(@Nullable Locale locale); boolean isAcceptedState(List<Class<? extends State>> acceptedDataTypes, State state);  }
@Test public void testAddGroupNameWithNull() { TestItem item = new TestItem("member1"); assertThrows(IllegalArgumentException.class, () -> item.addGroupName(toNull())); }