SortedUserList implements UserList { @Override public void removeUserListListener(final UserListListener listener) { Validate.notNull(listener, "UserListListener can not be null"); listeners.remove(listener); } SortedUserList(); @Override boolean add(final User user); @Nullable @Override User get(final int pos); @Override int indexOf(final User user); @Override boolean remove(final User user); @Override User set(final int pos, final User user); @Override int size(); @Override void addUserListListener(final UserListListener listener); @Override void removeUserListListener(final UserListListener listener); List<UserListListener> getListeners();  }
@Test public void removeUserListListenerShouldThrowExceptionIfListenerIsNull() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("UserListListener can not be null"); userList.removeUserListListener(null); }
@Test public void removeUserListListenerShouldRemoveTheListener() { userList.removeUserListListener(listener); addAllUsers(); verifyZeroInteractions(listener); }