### Question:
CircularList extends AbstractList<T> { @Override public Object[] toArray() { Object[] elementsCopy = new Object[size]; copy(elementsCopy); return elementsCopy; } CircularList(int capacity); int getCapacity(); T get(int index); int size(); @Override boolean isEmpty(); @Override boolean add(T newElement); @Override boolean addAll(Collection<? extends T> newElements); T removeFirst(); T first(); T last(); @Override void clear(); @Override java.util.Iterator<T> iterator(); @Override Object[] toArray(); @Override T[] toArray(T[] elementsCopy);  }### Answer:
@Test public void testToArray() { CircularList<String> list = new CircularList<>(5); assertArrayEquals(new String[0], list.toArray()); list.addAll(Arrays.asList("A", "B", "C")); assertArrayEquals(new String[]{"A", "B", "C"}, list.toArray()); list.addAll(Arrays.asList("D", "E")); assertArrayEquals(new String[]{"A", "B", "C", "D", "E"}, list.toArray()); list.addAll(Arrays.asList("F", "G")); assertArrayEquals(new String[]{"C", "D", "E", "F", "G"}, list.toArray()); }