diff --git a/tests/edu/caltech/cs2/project03/GuitarStringTests.java b/tests/edu/caltech/cs2/project03/GuitarStringTests.java index 0586d8e051e6be53961893c6fce6a6ff1bbb127c..accfc43995e98d722caf67e598a17ee0649802ab 100644 --- a/tests/edu/caltech/cs2/project03/GuitarStringTests.java +++ b/tests/edu/caltech/cs2/project03/GuitarStringTests.java @@ -81,6 +81,13 @@ public class GuitarStringTests { Reflection.assertNoPublicFields(CircularArrayFixedSizeQueueGuitarString.class); } + @Order(classSpecificTestLevel) + @DisplayName("There are no protected fields") + @Test + public void testNoProtectedFields() { + Reflection.assertNoProtectedFields(CircularArrayFixedSizeQueueGuitarString.class); + } + @Order(classSpecificTestLevel) @DisplayName("The public interface is correct") @Test @@ -133,6 +140,7 @@ public class GuitarStringTests { assertEquals(0, val, "initial values must be 0"); } string.pluck(); + queue = getQueueFromString(string); double sum = 0; double absSum = 0; for(double val : queue){ @@ -172,11 +180,13 @@ public class GuitarStringTests { // Pass through the same number of tics as elements in the array for(int i = 0; i < initSize; i++){ string.tic(); + queue = getQueueFromString(string); assertEquals(initSize, queue.size(), "queue size must remain the same"); } // Compare peek() values with the expected values in the files while (in.hasNext()) { string.tic(); + queue = getQueueFromString(string); assertEquals(initSize, queue.size(), "queue size must remain the same"); assertEquals(in.nextDouble(), queue.peek(), "next expected value not at front of queue"); } @@ -202,12 +212,14 @@ public class GuitarStringTests { assertEquals(expectedLength, string.length(), "Length should be same as expected"); assertEquals(queue.size(), string.length(), "Length should be same as queue size"); string.pluck(); + queue = getQueueFromString(string); assertEquals(initSize, string.length(), "Length should not have changed from beginning"); assertEquals(queue.size(), string.length(), "Length should be same as queue size"); // Run through many iterations, making sure both the queue size and length are constant for (int i = 0; i < iterations; i++) { string.tic(); + queue = getQueueFromString(string); assertEquals(initSize, string.length(), "Length should not have changed from beginning"); assertEquals(queue.size(), string.length(), "Length should be same as queue size"); } @@ -233,11 +245,13 @@ public class GuitarStringTests { assertEquals(0, string.sample(), "Sample should return 0 before plucking"); assertEquals(queue.peek(), string.sample(), "Sample should same as peek()ing queue"); string.pluck(); + queue = getQueueFromString(string); assertEquals(queue.peek(), string.sample(), "Sample should same as peek()ing queue"); // Run through many iterations, making sure sample() matches peek() for (int i = 0; i < iterations; i++) { string.tic(); + queue = getQueueFromString(string); assertEquals(queue.peek(), string.sample(), "Sample should same as peek()ing queue"); }