LockableList extends ArrayList<T> { @Override public void clear() { if (readOnly) { throw new JTransfoException(READ_ONLY); } super.clear(); }  void lock(); @Override T set(int i, T t); @Override boolean add(T t); @Override void add(int i, T t); @Override T remove(int i); @Override boolean remove(Object o); @Override void clear(); @Override boolean addAll(Collection<? extends T> ts); @Override boolean addAll(int i, Collection<? extends T> ts);  }
@Test public void clearTest() throws Exception { list.clear(); assertThat(list).hasSize(0).isEmpty(); }