### Question:
ShingleBuilder { public void addPoint(double[] point) { checkNotNull(point, "point must not be null"); checkArgument(point.length == dimensions, String.format("point.length must equal %d", dimensions)); System.arraycopy(point, 0, recentPoints[shingleIndex], 0, dimensions); shingleIndex = (shingleIndex + 1) % shingleSize; if (!full && shingleIndex == 0) { full = true; } } ShingleBuilder(int dimensions, int shingleSize, boolean cyclic);  ShingleBuilder(int dimensions, int shingleSize); boolean isFull(); int getInputPointSize(); int getShingledPointSize(); boolean isCyclic(); int getShingleIndex(); void addPoint(double[] point); double[] getShingle(); void getShingle(double[] shingle);  }### Answer:
@Test public void testAddPoint() { double[] shingle = builder.getShingle(); assertArrayEquals(new double[] { 0, 0, 0, 0, 0, 0 }, shingle); builder.addPoint(new double[] { 9, 10 }); shingle = builder.getShingle(); assertArrayEquals(new double[] { 0, 0, 0, 0, 9, 10 }, shingle); builder.addPoint(new double[] { 7, 8 }); shingle = builder.getShingle(); assertArrayEquals(new double[] { 0, 0, 9, 10, 7, 8 }, shingle); builder.addPoint(new double[] { 5, 6 }); shingle = builder.getShingle(); assertArrayEquals(new double[] { 9, 10, 7, 8, 5, 6 }, shingle); builder.addPoint(new double[] { 3, 4 }); shingle = builder.getShingle(); assertArrayEquals(new double[] { 7, 8, 5, 6, 3, 4 }, shingle); }
@Test public void testAddPointWithInvalidArguments() { assertThrows(NullPointerException.class, () -> builder.addPoint(null)); double[] point = new double[9]; assertThrows(IllegalArgumentException.class, () -> builder.addPoint(point)); }