### Question:
CircularBufferDouble extends ListDouble { public void addDouble(double value) { data[endOffset] = value; endOffset++; if (endOffset == data.length && !reachedMax) resize(); if (endOffset == data.length) { endOffset = 0; } if (endOffset == startOffset) startOffset++; if (startOffset == data.length) startOffset = 0; } CircularBufferDouble(int maxCapacity);  CircularBufferDouble(int initialCapacity, int maxCapacity); @Override double getDouble(int index); @Override int size(); void addDouble(double value); void clear(); int getCurrentCapacity();  }### Answer:
@Test public void iteration1() { CircularBufferDouble coll = new CircularBufferDouble(15); for (int i = 0; i < 10; i++) { coll.addDouble(1.0); } testCollection(coll); testList(coll); }
@Test public void add2() { CircularBufferDouble coll = new CircularBufferDouble(10); for (int i = 0; i < 11; i++) { coll.addDouble(i); } ListDouble reference = new ArrayDouble(new double[] {1,2,3,4,5,6,7,8,9,10}); assertThat(coll, equalTo(reference)); }
@Test public void add3() { CircularBufferDouble coll = new CircularBufferDouble(10); for (int i = 0; i < 5; i++) { coll.addDouble(i); } ListDouble reference = new ArrayDouble(new double[] {0,1,2,3,4}); assertThat(coll, equalTo(reference)); }
@Test public void add4() { CircularBufferDouble coll = new CircularBufferDouble(3); for (int i = 0; i < 5; i++) { coll.addDouble(i); } ListDouble reference = new ArrayDouble(new double[] {2,3,4}); assertThat(coll, equalTo(reference)); }