ThemeListImpl implements ThemeList, Serializable { @Override public void clear() { themes.clear(); updateThemeAttribute(); } ThemeListImpl(Element element); @Override Iterator<String> iterator(); @Override boolean add(String themeName); @Override boolean addAll(Collection<? extends String> themeNames); @Override boolean remove(Object themeName); @Override boolean retainAll(Collection<?> themeNamesToRetain); @Override boolean removeAll(Collection<?> themeNamesToRemove); @Override void clear(); @Override int size(); @Override boolean isEmpty(); @Override Object[] toArray(); @Override T[] toArray(T[] a); @Override boolean contains(Object themeName); @Override boolean containsAll(Collection<?> themeNames); @Override String toString(); static final String THEME_ATTRIBUTE_NAME; }
@Test public void clear() { MockElement element = new MockElement("theme1", "theme2"); ThemeListImpl themeList = new ThemeListImpl(element); themeList.clear(); assertTrue("ThemeList should be empty after it's cleared", themeList.isEmpty()); assertNull( "If corresponding ThemeList is cleared, no themes should be preset in the corresponding element", element.getAttribute(ThemeListImpl.THEME_ATTRIBUTE_NAME)); }