ResizableList implements List<T>, Serializable { public boolean resize(int size) { try { if (size < 0) { throw new IllegalArgumentException("Size must be a positive number."); } final int missing = size - innerList.size(); boolean addedMissing = missing > 0; for (int i = 0; i < missing; i++) { innerList.add(itemClass.newInstance()); } return addedMissing; } catch (Exception e) { throw new DQCommonRuntimeException("Unable to resize list of items.", e); } } ResizableList(Class<T> itemClass);  ResizableList(List<T> copyOfList); boolean resize(int size); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Iterator<T> iterator(); @Override Object[] toArray(); @Override Q[] toArray(Q[] qs); @Override boolean add(T t); @Override boolean remove(Object o); @Override boolean containsAll(Collection<?> collection); @Override boolean addAll(Collection<? extends T> collection); @Override boolean addAll(int i, Collection<? extends T> collection); @Override boolean removeAll(Collection<?> collection); @Override boolean retainAll(Collection<?> collection); @Override void clear(); @Override boolean equals(Object o); @Override int hashCode(); @Override T get(int i); @Override T set(int i, T t); @Override void add(int i, T t); @Override T remove(int i); @Override int indexOf(Object o); @Override int lastIndexOf(Object o); @Override ListIterator<T> listIterator(); @Override ListIterator<T> listIterator(int i); @Override List<T> subList(int i, int i1);  }
@Test(expected = DQCommonRuntimeException.class) public void testResizeMinusOne() throws Exception { try { list.resize(-1); } catch (DQCommonRuntimeException e) { assertEquals("Unable to resize list of items.", e.getMessage()); throw e; } }
@Test public void testResizeReturn() throws Exception { assertFalse(list.resize(0)); assertTrue(list.resize(1)); assertFalse(list.resize(1)); }
@Test public void testResizeReturnDown() throws Exception { assertFalse(list.resize(0)); assertTrue(list.resize(2)); assertFalse(list.resize(1)); }