### Question:
CompositeList extends CollectionList<EventList<E>, E> { public void addMemberList(EventList<E> member) { if (!getPublisher().equals(member.getPublisher())) throw new IllegalArgumentException("Member list must share publisher with CompositeList"); if (!getReadWriteLock().equals(member.getReadWriteLock())) throw new IllegalArgumentException("Member list must share lock with CompositeList"); source.add(member); } CompositeList(); @Deprecated  CompositeList(ReadWriteLock lock);  CompositeList(ListEventPublisher publisher, ReadWriteLock lock); void addMemberList(EventList<E> member); EventList<E> createMemberList(); void removeMemberList(EventList<E> list);  }### Answer:
@Test public void testAddMemberList() { final ReadWriteLock sharedLock = LockFactory.DEFAULT.createReadWriteLock(); final ListEventPublisher sharedPublisher = ListEventAssembler.createListEventPublisher(); final CompositeList<Object> uber = new CompositeList<>(sharedPublisher, sharedLock); final EventList<Object> alpha = new BasicEventList<>(); final EventList<Object> beta = new BasicEventList<>(sharedLock); final EventList<Object> gamma = new BasicEventList<>(sharedPublisher, sharedLock); try { uber.addMemberList(alpha); fail("Expected IllegalArgumentException for addMemberList"); } catch (IllegalArgumentException ex) { } try { uber.addMemberList(beta); fail("Expected IllegalArgumentException for addMemberList"); } catch (IllegalArgumentException ex) { } uber.addMemberList(gamma); assertSame(sharedLock, gamma.getReadWriteLock()); assertSame(sharedLock, uber.getReadWriteLock()); assertSame(sharedPublisher, gamma.getPublisher()); assertSame(sharedPublisher, uber.getPublisher()); }