ThemeListImpl implements ThemeList, Serializable { @Override public boolean add(String themeName) { boolean changed = themes.add(themeName); if (changed) { updateThemeAttribute(); } return changed; } 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 add() { String themeToAdd = "theme"; MockElement element = new MockElement(); ThemeListImpl themeList = new ThemeListImpl(element); themeList.add(themeToAdd); assertEquals("ThemeList should not be empty after adding a theme", themeList.size(), 1); assertTrue("ThemeList should contain theme added", themeList.contains(themeToAdd)); assertEquals("Corresponding element should contain the theme added", element.getAttribute(ThemeListImpl.THEME_ATTRIBUTE_NAME), themeToAdd); }