From a4f0a91d6e41b2cfe21df3932103d6e1c82ec8b4 Mon Sep 17 00:00:00 2001
From: WinJ <winstonjodjana@gmail.com>
Date: Thu, 20 Jan 2022 00:49:26 -0800
Subject: [PATCH] 22wi changes: All tests renamed and somewhat cleaned corpus
 moved to separate folder TopKSort clarification when k > array.length
 AutocompleteTrie edits Added part on AVLTree that they need correct internal
 structure

---
 alice.txt => corpus/alice.txt                 |   0
 dictionary.txt => corpus/dictionary.txt       |   0
 dictionary2.txt => corpus/dictionary2.txt     |   0
 eggs.txt => corpus/eggs.txt                   |   0
 irc.corpus => corpus/irc.corpus               |   0
 small.corpus => corpus/small.corpus           |   0
 spoken.corpus => corpus/spoken.corpus         |   0
 src/main/java/chat/uMessage.java              |   2 +-
 .../datastructures/dictionaries/AVLTree.java  |   4 +-
 src/main/java/p2/sorts/TopKSort.java          |   3 +
 .../p2/wordcorrector/AutocompleteTrie.java    |  10 +-
 .../ckpt1/CircularArrayComparatorTests.java   | 101 ++++++++-------
 .../ckpt1/MinFourHeapComparableTests.java     |  87 ++++++-------
 src/test/java/ckpt1/MoveToFrontListTests.java |  10 +-
 src/test/java/ckpt2/AVLTreeTests.java         |  83 ++++++-------
 ...Tests.java => ChainingHashTableTests.java} |  10 +-
 .../ckpt2/CircularArrayHashCodeTests.java     |  34 +++--
 src/test/java/ckpt2/HashTrieMapTests.java     | 116 +++++++++---------
 src/test/java/ckpt2/HeapSortTests.java        |   4 +-
 src/test/java/ckpt2/MinFourHeapTests.java     |  84 ++++++-------
 src/test/java/ckpt2/QuickSortTests.java       |   4 +-
 src/test/java/ckpt2/TopKSortTests.java        |   4 +-
 22 files changed, 271 insertions(+), 285 deletions(-)
 rename alice.txt => corpus/alice.txt (100%)
 rename dictionary.txt => corpus/dictionary.txt (100%)
 rename dictionary2.txt => corpus/dictionary2.txt (100%)
 rename eggs.txt => corpus/eggs.txt (100%)
 rename irc.corpus => corpus/irc.corpus (100%)
 rename small.corpus => corpus/small.corpus (100%)
 rename spoken.corpus => corpus/spoken.corpus (100%)
 rename src/test/java/ckpt2/{HashTableTests.java => ChainingHashTableTests.java} (82%)

diff --git a/alice.txt b/corpus/alice.txt
similarity index 100%
rename from alice.txt
rename to corpus/alice.txt
diff --git a/dictionary.txt b/corpus/dictionary.txt
similarity index 100%
rename from dictionary.txt
rename to corpus/dictionary.txt
diff --git a/dictionary2.txt b/corpus/dictionary2.txt
similarity index 100%
rename from dictionary2.txt
rename to corpus/dictionary2.txt
diff --git a/eggs.txt b/corpus/eggs.txt
similarity index 100%
rename from eggs.txt
rename to corpus/eggs.txt
diff --git a/irc.corpus b/corpus/irc.corpus
similarity index 100%
rename from irc.corpus
rename to corpus/irc.corpus
diff --git a/small.corpus b/corpus/small.corpus
similarity index 100%
rename from small.corpus
rename to corpus/small.corpus
diff --git a/spoken.corpus b/corpus/spoken.corpus
similarity index 100%
rename from spoken.corpus
rename to corpus/spoken.corpus
diff --git a/src/main/java/chat/uMessage.java b/src/main/java/chat/uMessage.java
index dde4817..a2f20bb 100644
--- a/src/main/java/chat/uMessage.java
+++ b/src/main/java/chat/uMessage.java
@@ -18,7 +18,7 @@ import java.util.function.Supplier;
 
 public class uMessage {
     private static final int N = 3;
-    private static final String CORPUS = "eggs.txt";
+    private static final String CORPUS = "corpus/eggs.txt";
     private static final Supplier<Dictionary<NGram, Dictionary<AlphabeticString, Integer>>> NEW_OUTER = NGramTester
             .trieConstructor(NGram.class);
     private static final Supplier<Dictionary<AlphabeticString, Integer>> NEW_INNER = NGramTester
diff --git a/src/main/java/datastructures/dictionaries/AVLTree.java b/src/main/java/datastructures/dictionaries/AVLTree.java
index 739f5db..8677d00 100644
--- a/src/main/java/datastructures/dictionaries/AVLTree.java
+++ b/src/main/java/datastructures/dictionaries/AVLTree.java
@@ -18,12 +18,12 @@ import cse332.datastructures.trees.BinarySearchTree;
  * the references used to access the instance).  Such masking will
  * lead to highly perplexing and erroneous behavior. Instead,
  * continue using the existing BSTNode children array.
- * 4. If this class has redundant methods, your score will be heavily
- * penalized.
+ * 4. Ensure that the class does not have redundant methods
  * 5. Cast children array to AVLNode whenever necessary in your
  * AVLTree. This will result a lot of casts, so we recommend you make
  * private methods that encapsulate those casts.
  * 6. Do NOT override the toString method. It is used for grading.
+ * 7. The internal structure of your AVLTree (from this.root to the leaves) must be correct
  */
 
 public class AVLTree<K extends Comparable<? super K>, V> extends BinarySearchTree<K, V> {
diff --git a/src/main/java/p2/sorts/TopKSort.java b/src/main/java/p2/sorts/TopKSort.java
index ae7dc5f..75434ac 100644
--- a/src/main/java/p2/sorts/TopKSort.java
+++ b/src/main/java/p2/sorts/TopKSort.java
@@ -9,6 +9,9 @@ public class TopKSort {
         sort(array, k, (x, y) -> x.compareTo(y));
     }
 
+    /**
+     * Behaviour is undefined when k > array.length
+     */
     public static <E> void sort(E[] array, int k, Comparator<E> comparator) {
         throw new NotYetImplementedException();
     }
diff --git a/src/main/java/p2/wordcorrector/AutocompleteTrie.java b/src/main/java/p2/wordcorrector/AutocompleteTrie.java
index aee2144..c3d37e7 100644
--- a/src/main/java/p2/wordcorrector/AutocompleteTrie.java
+++ b/src/main/java/p2/wordcorrector/AutocompleteTrie.java
@@ -21,21 +21,19 @@ public class AutocompleteTrie extends HashTrieMap<Character, AlphabeticString, I
             }
         }
 
-        String result = key;
+        StringBuilder result = new StringBuilder(key);
 
         while (current.pointers.size() == 1) {
             if (current.value != null) {
                 return null;
             }
-            result += current.pointers.keySet().iterator().next();
+            result.append(current.pointers.keySet().iterator().next());
             current = current.pointers.values().iterator().next();
         }
 
-        // Switch this to return null to only complete if we're at the end of
-        // the word
         if (current.pointers.size() != 0) {
-            return result;
+            return result.toString();
         }
-        return result;
+        return result.toString();
     }
 }
\ No newline at end of file
diff --git a/src/test/java/ckpt1/CircularArrayComparatorTests.java b/src/test/java/ckpt1/CircularArrayComparatorTests.java
index 4485714..bb5547a 100644
--- a/src/test/java/ckpt1/CircularArrayComparatorTests.java
+++ b/src/test/java/ckpt1/CircularArrayComparatorTests.java
@@ -11,118 +11,127 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class CircularArrayComparatorTests {
 
-    private CircularArrayFIFOQueue<String> init() {
-        return new CircularArrayFIFOQueue<String>(10);
-    }
-
-    private boolean result(int a, int b) {
-        return Integer.signum(a) == Integer.signum(b);
-    }
-
     @Test
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void test_empty_empty() {
-        CircularArrayFIFOQueue<String> l1 = init();
-        CircularArrayFIFOQueue<String> l2 = init();
-        assertTrue(result(l1.compareTo(l2), "".compareTo("")));
+    public void test_compareTo_empty_equalTo() {
+        CircularArrayFIFOQueue<String> l1 = new CircularArrayFIFOQueue<>(10);
+        CircularArrayFIFOQueue<String> l2 = new CircularArrayFIFOQueue<>(10);
+
+        // Checks if comparing two empty CAFQ is the same as comparing 2 empty strings.
+        assertEquals(Integer.signum("".compareTo("")), Integer.signum(l1.compareTo(l2)));
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void test_ab_ab() {
-        CircularArrayFIFOQueue<String> l1 = init();
-        CircularArrayFIFOQueue<String> l2 = init();
+    public void test_compareTo_sameElements_equalTo() {
+        CircularArrayFIFOQueue<String> l1 = new CircularArrayFIFOQueue<>(10);
+        CircularArrayFIFOQueue<String> l2 = new CircularArrayFIFOQueue<>(10);
         l1.add("a");
         l1.add("b");
+
         l2.add("a");
         l2.add("b");
-        assertTrue(result(l1.compareTo(l2), "ab".compareTo("ab")));
+
+        assertEquals(Integer.signum("ab".compareTo("ab")), Integer.signum(l1.compareTo(l2)));
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void test_ab_abc() {
-        CircularArrayFIFOQueue<String> l1 = init();
-        CircularArrayFIFOQueue<String> l2 = init();
+    public void test_compareTo_differentElements_lessThan() {
+        CircularArrayFIFOQueue<String> l1 = new CircularArrayFIFOQueue<>(10);
+        CircularArrayFIFOQueue<String> l2 = new CircularArrayFIFOQueue<>(10);
         l1.add("a");
         l1.add("b");
+
         l2.add("a");
         l2.add("b");
         l2.add("c");
-        assertTrue(result(l1.compareTo(l2), "ab".compareTo("abc")));
+
+        assertEquals(Integer.signum("ab".compareTo("abc")), Integer.signum(l1.compareTo(l2)));
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void test_abc_ab() {
-        CircularArrayFIFOQueue<String> l1 = init();
-        CircularArrayFIFOQueue<String> l2 = init();
+    public void test_compareTo_differentElements_greaterThan() {
+        CircularArrayFIFOQueue<String> l1 = new CircularArrayFIFOQueue<>(10);
+        CircularArrayFIFOQueue<String> l2 = new CircularArrayFIFOQueue<>(10);
         l1.add("a");
         l1.add("b");
         l1.add("c");
+
         l2.add("a");
         l2.add("b");
-        assertTrue(result(l1.compareTo(l2), "abc".compareTo("ab")));
+
+        assertEquals(Integer.signum("abc".compareTo("ab")), Integer.signum(l1.compareTo(l2)));
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void test_ac_abc() {
-        CircularArrayFIFOQueue<String> l1 = init();
-        CircularArrayFIFOQueue<String> l2 = init();
+    public void test_compareTo_differentElements2_greaterThan() {
+        CircularArrayFIFOQueue<String> l1 = new CircularArrayFIFOQueue<>(10);
+        CircularArrayFIFOQueue<String> l2 = new CircularArrayFIFOQueue<>(10);
         l1.add("a");
         l1.add("c");
+
         l2.add("a");
         l2.add("b");
         l2.add("c");
-        assertTrue(result(l1.compareTo(l2), "ac".compareTo("abc")));
+
+        assertEquals(Integer.signum("ac".compareTo("abc")), Integer.signum(l1.compareTo(l2)));
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void test_a_aa() {
-        CircularArrayFIFOQueue<String> l1 = init();
-        CircularArrayFIFOQueue<String> l2 = init();
+    public void test_compareTo_differentElements3_greaterThan() {
+        CircularArrayFIFOQueue<String> l1 = new CircularArrayFIFOQueue<>(10);
+        CircularArrayFIFOQueue<String> l2 = new CircularArrayFIFOQueue<>(10);
         l1.add("a");
+
         l2.add("a");
         l2.add("a");
-        assertTrue(result(l1.compareTo(l2), "a".compareTo("aa")));
+
+        assertEquals(Integer.signum("a".compareTo("aa")), Integer.signum(l1.compareTo(l2)));
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void test_compare_transitive() {
-        CircularArrayFIFOQueue<String> l1 = init();
-        CircularArrayFIFOQueue<String> l2 = init();
-        CircularArrayFIFOQueue<String> l3 = init();
-
+    public void test_compareTo_transitive_correct() {
+        CircularArrayFIFOQueue<String> l1 = new CircularArrayFIFOQueue<>(10);
+        CircularArrayFIFOQueue<String> l2 = new CircularArrayFIFOQueue<>(10);
+        CircularArrayFIFOQueue<String> l3 = new CircularArrayFIFOQueue<>(10);
         l1.add("abc");
         l2.add("def");
         l3.add("efg");
-        assertTrue(l1.compareTo(l2) < 0 && l2.compareTo(l3) < 0 && l1.compareTo(l3) < 0) ;
+
+        assertTrue(l1.compareTo(l2) < 0, "\"abc\" should be less than \"def\"") ;
+        assertTrue(l1.compareTo(l3) < 0, "\"abc\" should be less than \"efg\"");
+        assertTrue(l2.compareTo(l3) < 0, "\"def\" should be less than \"efg\"");
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void test_equality_consistent_with_compare() {
-        CircularArrayFIFOQueue<String> l1 = init();
-        CircularArrayFIFOQueue<String> l2 = init();
+    public void test_compareToEquality_sameElements_sameResults() {
+        CircularArrayFIFOQueue<String> l1 = new CircularArrayFIFOQueue<>(10);
+        CircularArrayFIFOQueue<String> l2 = new CircularArrayFIFOQueue<>(10);
         l1.add("a");
         l1.add("b");
+
         l2.add("a");
         l2.add("b");
+
         assertEquals(l1, l2);
-        assertEquals(l1.compareTo(l2), 0);
+        assertEquals(0, l1.compareTo(l2));
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void test_equals_doesnt_modify() {
-        CircularArrayFIFOQueue<String> l1 = init();
-        CircularArrayFIFOQueue<String> l2 = init();
+    public void test_equals_sameElements_nothingHappens() {
+        CircularArrayFIFOQueue<String> l1 = new CircularArrayFIFOQueue<>(10);
+        CircularArrayFIFOQueue<String> l2 = new CircularArrayFIFOQueue<>(10);
         l1.add("a");
         l2.add("a");
+
         l1.equals(l2);
-        assertEquals(l1.size(), 1);
+        assertEquals(1, l1.size());
     }
 }
diff --git a/src/test/java/ckpt1/MinFourHeapComparableTests.java b/src/test/java/ckpt1/MinFourHeapComparableTests.java
index c958479..2501d67 100644
--- a/src/test/java/ckpt1/MinFourHeapComparableTests.java
+++ b/src/test/java/ckpt1/MinFourHeapComparableTests.java
@@ -14,35 +14,30 @@ import java.util.concurrent.TimeUnit;
 import static org.junit.jupiter.api.Assertions.*;
 
 public class MinFourHeapComparableTests {
-    private static WorkList<String> STUDENT_STR;
-    private static WorkList<Double> STUDENT_DOUBLE;
-    private static WorkList<Integer> STUDENT_INT;
-    private static Random RAND;
-
-    @BeforeEach
-    public void init() {
-        STUDENT_STR = new MinFourHeapComparable<>();
-        STUDENT_DOUBLE = new MinFourHeapComparable<>();
-        STUDENT_INT = new MinFourHeapComparable<>();
-        RAND = new Random(42);
-    }
+    private static final int SEED = 42;
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testHasWork() {
+    public void test_hasWork_empty_noWork() {
+        WorkList<Integer> STUDENT_INT = new MinFourHeapComparable<>();
+
         assertFalse(STUDENT_INT.hasWork());
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testHasWorkAfterAdd() {
+    public void test_hasWork_oneElement_hasWork() {
+        WorkList<Integer> STUDENT_INT = new MinFourHeapComparable<>();
+
         STUDENT_INT.add(1);
         assertTrue(STUDENT_INT.hasWork());
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testHasWorkAfterAddRemove() {
+    public void test_hasWork_manyElements_noWork() {
+        WorkList<Double> STUDENT_DOUBLE = new MinFourHeapComparable<>();
+
         for (int i = 0; i < 1000; i++) {
             STUDENT_DOUBLE.add(Math.random());
         }
@@ -53,24 +48,35 @@ public class MinFourHeapComparableTests {
     }
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testPeekHasException() {
-        assertTrue(doesPeekThrowException(STUDENT_INT));
+    public void test_peek_empty_exceptionThrown() {
+        WorkList<Integer> STUDENT_INT = new MinFourHeapComparable<>();
+        assertThrows(NoSuchElementException.class, () -> {
+            STUDENT_INT.peek();
+        });
 
         addAndRemove(STUDENT_INT, 42, 10);
-        assertTrue(doesPeekThrowException(STUDENT_INT));
+        assertThrows(NoSuchElementException.class, () -> {
+            STUDENT_INT.peek();
+        });
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testNextHasException() {
-        assertTrue(doesNextThrowException(STUDENT_INT));
+    public void test_next_empty_exceptionThrown() {
+        WorkList<Integer> STUDENT_INT = new MinFourHeapComparable<>();
+        assertThrows(NoSuchElementException.class, () -> {
+            STUDENT_INT.next();
+        });
 
         addAndRemove(STUDENT_INT, 42, 10);
-        assertTrue(doesNextThrowException(STUDENT_INT));
+        assertThrows(NoSuchElementException.class, () -> {
+            STUDENT_INT.next();
+        });
     }
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testClear() {
+    public void test_clear_fewElements_empty() {
+        WorkList<String> STUDENT_STR = new MinFourHeapComparable<>();
         addAll(STUDENT_STR, new String[]{"Beware", "the", "Jabberwock", "my", "son!"});
 
         assertTrue(STUDENT_STR.hasWork());
@@ -79,13 +85,17 @@ public class MinFourHeapComparableTests {
         STUDENT_STR.clear();
         assertFalse(STUDENT_STR.hasWork());
         assertEquals(0, STUDENT_STR.size());
-        assertTrue(doesPeekThrowException(STUDENT_STR));
-        assertTrue(doesNextThrowException(STUDENT_STR));
+        assertThrows(NoSuchElementException.class, () -> {
+            STUDENT_STR.peek();
+        });
+        assertThrows(NoSuchElementException.class, () -> {
+            STUDENT_STR.next();
+        });
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testHeapWith5Items() {
+    public void test_add_fewElements_correct() {
         PriorityWorkList<String> heap = new MinFourHeapComparable<>();
         String[] tests = { "a", "b", "c", "d", "e" };
         for (int i = 0; i < 5; i++) {
@@ -102,7 +112,7 @@ public class MinFourHeapComparableTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testOrderingDoesNotMatter() {
+    public void test_addPeekNext_fewElements_correctOrdering() {
         PriorityWorkList<String> ordered = new MinFourHeapComparable<>();
         PriorityWorkList<String> reversed = new MinFourHeapComparable<>();
         PriorityWorkList<String> random = new MinFourHeapComparable<>();
@@ -128,7 +138,7 @@ public class MinFourHeapComparableTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testHugeHeap() {
+    public void test_addNext_manyElements_correctOrdering() {
         PriorityWorkList<String> heap = new MinFourHeapComparable<>();
         int n = 10000;
 
@@ -146,7 +156,8 @@ public class MinFourHeapComparableTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testWithCustomComparable() {
+    public void test_peekNextCustomComparator_manyElements_correctOrdering() {
+        Random RAND = new Random(SEED);
         PriorityWorkList<Coordinate> student = new MinFourHeapComparable<>();
         Queue<Coordinate> reference = new PriorityQueue<>();
 
@@ -165,7 +176,7 @@ public class MinFourHeapComparableTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void checkStructure() {
+    public void test_addNext_severalElements_correctStructure() {
         PriorityWorkList<Integer> heap = new MinFourHeapComparable<>();
         addAll(heap, new Integer[] {10, 10, 15, 1, 17, 16, 100, 101, 102, 103, 105, 106, 107, 108});
 
@@ -246,22 +257,4 @@ public class MinFourHeapComparableTests {
             worklist.next();
         }
     }
-
-    protected static <E> boolean doesPeekThrowException(WorkList<E> worklist) {
-        try {
-            worklist.peek();
-        } catch (NoSuchElementException e) {
-            return true;
-        }
-        return false;
-    }
-
-    protected static <E> boolean doesNextThrowException(WorkList<E> worklist) {
-        try {
-            worklist.next();
-        } catch (NoSuchElementException e) {
-            return true;
-        }
-        return false;
-    }
 }
diff --git a/src/test/java/ckpt1/MoveToFrontListTests.java b/src/test/java/ckpt1/MoveToFrontListTests.java
index cdacc3f..5f366d4 100644
--- a/src/test/java/ckpt1/MoveToFrontListTests.java
+++ b/src/test/java/ckpt1/MoveToFrontListTests.java
@@ -16,7 +16,7 @@ public class MoveToFrontListTests {
 	@SuppressWarnings("unchecked")
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void checkStructure() {
+	public void test_insertIterator_severalElements_correctStructure() {
 		MoveToFrontList<Integer, Integer> list = new MoveToFrontList<Integer, Integer>();
 
 		int[] arr = {6, 5, 10, 14, 10, 31, 10, 13, 10, 10, 12, 10, 14, 10, 10, 11, 10, 14, 9, 8, 3, 2, 1, 0, 7, 4};
@@ -37,14 +37,13 @@ public class MoveToFrontListTests {
 
 		// Compare strings to make sure we get the right one
 		// Can use list.toString as well, but I'm not sure if students may modify that
-		String mtf_correct = "[4=1, 7=1, 0=1, 1=1, 2=1, 3=1, 8=1, 9=1, 14=3, 10=9, 11=1, 12=1, 13=1, 31=1, 5=1, 6=1]";
 		String mtf_test = Arrays.toString(dcs);
-		assertEquals(mtf_correct, mtf_test);
+		assertEquals("[4=1, 7=1, 0=1, 1=1, 2=1, 3=1, 8=1, 9=1, 14=3, 10=9, 11=1, 12=1, 13=1, 31=1, 5=1, 6=1]", mtf_test);
 	}
 
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void testHugeMTFList() {
+	public void test_insertFind_manyElements_correctStructure() {
 		MoveToFrontList<String, Integer> list = new MoveToFrontList<>();
 
 		int n = 1000;
@@ -56,7 +55,8 @@ public class MoveToFrontListTests {
 			for (int j = 0; j < k + 1; j ++)
 				list.insert(str, list.find(str) == null ? 1 : list.find(str) + 1);
 		}
-		// Delete them all
+
+        // Check the elements
 		int totalCount = 0;
 		for (Item<String, Integer> dc : list) {
 			assertEquals((Integer.parseInt(dc.key) + 1) * 5, dc.value.intValue());
diff --git a/src/test/java/ckpt2/AVLTreeTests.java b/src/test/java/ckpt2/AVLTreeTests.java
index 9765dc3..ae31af7 100644
--- a/src/test/java/ckpt2/AVLTreeTests.java
+++ b/src/test/java/ckpt2/AVLTreeTests.java
@@ -15,11 +15,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 public class AVLTreeTests {
 
-	private AVLTree<String, Integer> init() {
-		return new AVLTree<>();
-	}
-
-	private <E extends Comparable<E>> void incCount(Dictionary<E, Integer> tree, E key) {
+	private <E extends Comparable<E>> void incrementValueWithKey(Dictionary<E, Integer> tree, E key) {
 		Integer value = tree.find(key);
 		if (value == null) {
 			tree.insert(key, 1);
@@ -31,57 +27,52 @@ public class AVLTreeTests {
 	@SuppressWarnings("rawtypes")
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void checkStructure() {
+	public void test_insertFind_severalElements_correctStructure() {
 		AVLTree<Integer, Integer> tree = new AVLTree<>();
-		incCount(tree, 10);
-		incCount(tree, 14);
-		incCount(tree, 10);
-		incCount(tree, 31);
-		incCount(tree, 10);
-		incCount(tree, 13);
-		incCount(tree, 10);
-		incCount(tree, 10);
-		incCount(tree, 12);
-		incCount(tree, 10);
-		incCount(tree, 13);
-		incCount(tree, 10);
-		incCount(tree, 10);
-		incCount(tree, 11);
-		incCount(tree, 10);
-		incCount(tree, 14);
-		incCount(tree, 9);
-		incCount(tree, 8);
-		incCount(tree, 7);
-		incCount(tree, 6);
-		incCount(tree, 5);
-		incCount(tree, 4);
-		incCount(tree, 3);
-		incCount(tree, 2);
-		incCount(tree, 1);
-		incCount(tree, 0);
-//		{10, 14, 10, 31, 10, 13, 10, 10, 12, 10, 13, 10, 10, 11, 10, 14, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
-//		{10, 14, 31, 13, 12, 11, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
+        // {10, 14, 10, 31, 10, 13, 10, 10, 12, 10, 13, 10, 10, 11, 10, 14, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
+		incrementValueWithKey(tree, 10);
+		incrementValueWithKey(tree, 14);
+		incrementValueWithKey(tree, 10);
+		incrementValueWithKey(tree, 31);
+		incrementValueWithKey(tree, 10);
+		incrementValueWithKey(tree, 13);
+		incrementValueWithKey(tree, 10);
+		incrementValueWithKey(tree, 10);
+		incrementValueWithKey(tree, 12);
+		incrementValueWithKey(tree, 10);
+		incrementValueWithKey(tree, 13);
+		incrementValueWithKey(tree, 10);
+		incrementValueWithKey(tree, 10);
+		incrementValueWithKey(tree, 11);
+
+        // {10, 14, 31, 13, 12, 11, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
+		incrementValueWithKey(tree, 10);
+		incrementValueWithKey(tree, 14);
+		incrementValueWithKey(tree, 9);
+		incrementValueWithKey(tree, 8);
+		incrementValueWithKey(tree, 7);
+		incrementValueWithKey(tree, 6);
+		incrementValueWithKey(tree, 5);
+		incrementValueWithKey(tree, 4);
+		incrementValueWithKey(tree, 3);
+		incrementValueWithKey(tree, 2);
+		incrementValueWithKey(tree, 1);
+		incrementValueWithKey(tree, 0);
 
 		BSTNode root = getField(tree, "root");
 
 		String trueData = " [8 [4 [2 [1 [0..].] [3..]] [6 [5..] [7..]]] [12 [10 [9..] [11..]] [14 [13..] [31..]]]]";
 		String trueCounts = " [1 [1 [1 [1 [1..].] [1..]] [1 [1..] [1..]]] [1 [9 [1..] [1..]] [2 [2..] [1..]]]]";
-//		String trueData = " [10 [6 [2 [1 [0..].] [4 [3..] [5..]]] [8 [7..] [9..]]] [13 [12 [11..].] [14. [31..]]]]";
-//		String trueCounts = " [9 [1 [1 [1 [1..].] [1 [1..] [1..]]] [1 [1..] [1..]]] [2 [1 [1..].] [2. [1..]]]]";
 
-//		System.err.println(nestd(root));
-//		System.err.println(trueData);
 		assertEquals(trueData, nestd(root));
 		assertEquals(trueCounts, nestc(root));
 	}
 
-	@SuppressWarnings("rawtypes")
 	public String nestd(BSTNode root) {
 		if(root == null)
 			return ".";
 		return " [" + root.key + nestd(root.children[0]) + nestd(root.children[1]) + "]";
 	}
-	@SuppressWarnings("rawtypes")
 	public String nestc(BSTNode root) {
 		if(root == null)
 			return ".";
@@ -90,13 +81,13 @@ public class AVLTreeTests {
 
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void testTreeWith5Items() {
-		AVLTree<String, Integer> tree = init();
+	public void test_insertFind_fewElements_correctStructure() {
+		AVLTree<String, Integer> tree =  new AVLTree<>();
 		String[] tests_struct = { "a", "b", "c", "d", "e" };
 		String[] tests = { "b", "d", "e", "c", "a" };
 		for (int i = 0; i < 5; i++) {
 			String str = tests[i] + "a";
-			incCount(tree, str);
+			incrementValueWithKey(tree, str);
 		}
 
 		int i = 0;
@@ -110,8 +101,8 @@ public class AVLTreeTests {
 
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void testHugeTree() {
-		AVLTree<String, Integer> tree = init();
+	public void test_insertFind_manyElements_correctStructure() {
+		AVLTree<String, Integer> tree = new AVLTree<>();
 		int n = 1000;
 
 		// Add them
@@ -119,7 +110,7 @@ public class AVLTreeTests {
 			int k = (i % n) * 37 % n;
 			String str = String.format("%05d", k);
 			for (int j = 0; j < k + 1; j ++)
-				incCount(tree, str);
+				incrementValueWithKey(tree, str);
 		}
 
 		// Calculate count of all values in tree
diff --git a/src/test/java/ckpt2/HashTableTests.java b/src/test/java/ckpt2/ChainingHashTableTests.java
similarity index 82%
rename from src/test/java/ckpt2/HashTableTests.java
rename to src/test/java/ckpt2/ChainingHashTableTests.java
index 6305910..4e18e65 100644
--- a/src/test/java/ckpt2/HashTableTests.java
+++ b/src/test/java/ckpt2/ChainingHashTableTests.java
@@ -12,19 +12,19 @@ import java.util.concurrent.TimeUnit;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 
-public class HashTableTests {
+public class ChainingHashTableTests {
 
-	private void incCount(Dictionary<String, Integer> list, String key) {
+	private void incrementValueWithKey(Dictionary<String, Integer> list, String key) {
 		Integer find = list.find(key);
 		if (find == null)
 			list.insert(key, 1);
 		else
-			list.insert(key, 1 + find);
+			list.insert(key, find + 1);
 	}
 
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void testHugeHashTable() {
+	public void test_insertFind_manyElements_correctStructure() {
 		ChainingHashTable<String, Integer> list = new ChainingHashTable<>(MoveToFrontList::new);
 
 		int n = 1000;
@@ -34,7 +34,7 @@ public class HashTableTests {
 			int k = (i % n) * 37 % n;
 			String str = String.format("%05d", k);
 			for (int j = 0; j < k + 1; j ++)
-				incCount(list, str);
+				incrementValueWithKey(list, str);
 		}
 
 		// Delete them all
diff --git a/src/test/java/ckpt2/CircularArrayHashCodeTests.java b/src/test/java/ckpt2/CircularArrayHashCodeTests.java
index 2854860..0b4b661 100644
--- a/src/test/java/ckpt2/CircularArrayHashCodeTests.java
+++ b/src/test/java/ckpt2/CircularArrayHashCodeTests.java
@@ -11,15 +11,11 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals;
 
 public class CircularArrayHashCodeTests {
 
-	private CircularArrayFIFOQueue<String> init() {
-		return new CircularArrayFIFOQueue<String>(10);
-	}
-
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void equality() {
-		CircularArrayFIFOQueue<String> l1 = init();
-		CircularArrayFIFOQueue<String> l2 = init();
+	public void test_hashCode_fewElements_equal() {
+		CircularArrayFIFOQueue<String> l1 = new CircularArrayFIFOQueue<>(10);
+		CircularArrayFIFOQueue<String> l2 = new CircularArrayFIFOQueue<>(10);
 		for (int i = 0; i < 3; i++) {
 			l1.add("a");
 			l2.add("a");
@@ -29,9 +25,9 @@ public class CircularArrayHashCodeTests {
 
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void ineq1() {
-		CircularArrayFIFOQueue<String> l1 = init();
-		CircularArrayFIFOQueue<String> l2 = init();
+	public void test_hashCode_fewElements_notEqual() {
+		CircularArrayFIFOQueue<String> l1 = new CircularArrayFIFOQueue<>(10);
+		CircularArrayFIFOQueue<String> l2 = new CircularArrayFIFOQueue<>(10);
 		l1.add("a");
 		l1.add("a");
 		l1.add("b");
@@ -43,9 +39,9 @@ public class CircularArrayHashCodeTests {
 
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void ineq2() {
-		CircularArrayFIFOQueue<String> l1 = init();
-		CircularArrayFIFOQueue<String> l2 = init();
+	public void test_hashCode_fewElements2_notEqual() {
+		CircularArrayFIFOQueue<String> l1 = new CircularArrayFIFOQueue<>(10);
+		CircularArrayFIFOQueue<String> l2 = new CircularArrayFIFOQueue<>(10);
 		l1.add("a");
 		l1.add("a");
 		l1.add("a");
@@ -58,9 +54,9 @@ public class CircularArrayHashCodeTests {
 
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void ineq3() {
-		CircularArrayFIFOQueue<String> l1 = init();
-		CircularArrayFIFOQueue<String> l2 = init();
+	public void test_hashCode_fewElements3_notEqual() {
+		CircularArrayFIFOQueue<String> l1 = new CircularArrayFIFOQueue<>(10);
+		CircularArrayFIFOQueue<String> l2 = new CircularArrayFIFOQueue<>(10);
 		l1.add("a");
 		l1.add("b");
 		l1.add("c");
@@ -72,9 +68,9 @@ public class CircularArrayHashCodeTests {
 
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void equality_consistent_with_hashcode() {
-		CircularArrayFIFOQueue<String> l1 = init();
-		CircularArrayFIFOQueue<String> l2 = init();
+	public void test_equalHashCode_fewElements2_equal() {
+		CircularArrayFIFOQueue<String> l1 = new CircularArrayFIFOQueue<>(10);
+		CircularArrayFIFOQueue<String> l2 = new CircularArrayFIFOQueue<>(10);
 		l1.add("a");
 		l1.add("b");
 		l2.add("a");
diff --git a/src/test/java/ckpt2/HashTrieMapTests.java b/src/test/java/ckpt2/HashTrieMapTests.java
index 0b4f58e..846247a 100644
--- a/src/test/java/ckpt2/HashTrieMapTests.java
+++ b/src/test/java/ckpt2/HashTrieMapTests.java
@@ -14,19 +14,14 @@ import java.util.concurrent.TimeUnit;
 import static org.junit.jupiter.api.Assertions.*;
 
 public class HashTrieMapTests {
-    protected static HashTrieMap<Character, AlphabeticString, String> STUDENT;
-
-    @BeforeEach
-    public void init() {
-        STUDENT = new HashTrieMap<>(AlphabeticString.class);
-    }
 
     /**
      * Tests if insert, find, and findPrefix work in general.
      */
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testBasic() {
+    public void test_insertFindFindPrefix_fewElements_correctStructure() {
+        HashTrieMap<Character, AlphabeticString, String> STUDENT = new HashTrieMap<>(AlphabeticString.class);
         String[] words = {"dog", "doggy", "doge", "dragon", "cat", "draggin"};
         String[] invalid = {"d", "cataract", "", "do"};
         addAll(STUDENT, words);
@@ -39,7 +34,8 @@ public class HashTrieMapTests {
      */
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testFindPrefixes() {
+    public void test_findPrefix_fewElements_correctStructure() {
+        HashTrieMap<Character, AlphabeticString, String> STUDENT = new HashTrieMap<>(AlphabeticString.class);
         String[] words = {"dog", "doggy", "doge", "dragon", "cat", "draggin"};
         addAll(STUDENT, words);
 
@@ -52,7 +48,8 @@ public class HashTrieMapTests {
      */
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testFindNonexistentDoesNotCrash() {
+    public void test_finds_nonexistentKey_doesNotCrash() {
+        HashTrieMap<Character, AlphabeticString, String> STUDENT = new HashTrieMap<>(AlphabeticString.class);
         addAll(STUDENT, "foo", "bar", "baz");
         assertNull(STUDENT.find(a("orangutan")));
         assertNull(STUDENT.find(a("z")));
@@ -64,7 +61,8 @@ public class HashTrieMapTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testFindingNullKeyCausesError() {
+    public void test_finds_nullKey_throwsException() {
+        HashTrieMap<Character, AlphabeticString, String> STUDENT = new HashTrieMap<>(AlphabeticString.class);
         assertThrows(IllegalArgumentException.class, () -> {
             STUDENT.find(null);
         });
@@ -72,7 +70,8 @@ public class HashTrieMapTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testFindingNullPrefixCausesError() {
+    public void test_findPrefix_nullKey_throwsException() {
+        HashTrieMap<Character, AlphabeticString, String> STUDENT = new HashTrieMap<>(AlphabeticString.class);
         assertThrows(IllegalArgumentException.class, () -> {
             STUDENT.findPrefix(null);
         });
@@ -83,7 +82,8 @@ public class HashTrieMapTests {
      */
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testInsertReplacesOldValue() {
+    public void test_insert_fewElements_valueReplaced() {
+        HashTrieMap<Character, AlphabeticString, String> STUDENT = new HashTrieMap<>(AlphabeticString.class);
         AlphabeticString key = a("myKey");
         assertNull(STUDENT.insert(key, "foo"));
         assertEquals("foo", STUDENT.insert(key, "bar"));
@@ -92,7 +92,8 @@ public class HashTrieMapTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testInsertingNullKeyCausesError() {
+    public void test_insert_nullKey_throwsException() {
+        HashTrieMap<Character, AlphabeticString, String> STUDENT = new HashTrieMap<>(AlphabeticString.class);
         assertThrows(IllegalArgumentException.class, () -> {
             STUDENT.insert(null, "foo");
         });
@@ -100,7 +101,8 @@ public class HashTrieMapTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testInsertingNullValueCausesError() {
+    public void test_insert_nullValue_throwsException() {
+        HashTrieMap<Character, AlphabeticString, String> STUDENT = new HashTrieMap<>(AlphabeticString.class);
         assertThrows(IllegalArgumentException.class, () -> {
             STUDENT.insert(a("foo"), null);
         });
@@ -108,7 +110,8 @@ public class HashTrieMapTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testDeletingCausesError() {
+    public void test_delete_oneElement_throwsException() {
+        HashTrieMap<Character, AlphabeticString, String> STUDENT = new HashTrieMap<>(AlphabeticString.class);
         assertThrows(UnsupportedOperationException.class, () -> {
             STUDENT.insert(a("foo"), "doo");
             STUDENT.delete(a("foo"));
@@ -117,7 +120,8 @@ public class HashTrieMapTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testClearCausesError() {
+    public void test_clear_oneElement_throwsException() {
+        HashTrieMap<Character, AlphabeticString, String> STUDENT = new HashTrieMap<>(AlphabeticString.class);
         assertThrows(UnsupportedOperationException.class, () -> {
             STUDENT.insert(a("foo"), "doo");
             STUDENT.clear();
@@ -126,7 +130,8 @@ public class HashTrieMapTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void checkUnderlyingStructure() {
+    public void test_insert_fewElements_correctInternalStructure() {
+        HashTrieMap<Character, AlphabeticString, String> STUDENT = new HashTrieMap<>(AlphabeticString.class);
         STUDENT.insert(a(""), "A");
         STUDENT.insert(a("foo"), "B");
         STUDENT.insert(a("fez"), "C");
@@ -150,6 +155,45 @@ public class HashTrieMapTests {
         assertTrue(equals(fullExpected, getField(STUDENT, "root")));
     }
 
+    @Test()
+    @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
+    public void test_insertFindFindPrefix_manyElements_correctStructure() {
+        HashTrieMap<Character, AlphabeticString, String> STUDENT = new HashTrieMap<>(AlphabeticString.class);
+        // Should contain 30 characters
+        char[] symbols = "abcdefghijklmnopqrstuvwxyz!@#$".toCharArray();
+        long i = 0;
+        for (char a : symbols) {
+            for (char b : symbols) {
+                for (char c : symbols) {
+                    for (char d : symbols) {
+                        Character[] word = new Character[]{a, b, c, d};
+                        STUDENT.insert(new AlphabeticString(word), "" + i);
+                        i += 1;
+                    }
+                }
+            }
+        }
+
+        for (char a : symbols) {
+            for (char b : symbols) {
+                assertTrue(STUDENT.findPrefix(new AlphabeticString(new Character[]{a, b})));
+            }
+        }
+
+        i = 0;
+        for (char a : symbols) {
+            for (char b : symbols) {
+                for (char c : symbols) {
+                    for (char d : symbols) {
+                        Character[] word = new Character[]{a, b, c, d};
+                        assertEquals("" + i, STUDENT.find(new AlphabeticString(word)));
+                        i += 1;
+                    }
+                }
+            }
+        }
+    }
+
     protected static boolean equals(MockNode expected, HashTrieMap<Character, AlphabeticString, String>.HashTrieNode student) {
         if (expected == null && student == null) {
             return true;
@@ -193,44 +237,6 @@ public class HashTrieMapTests {
         }
     }
 
-    @Test()
-    @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void stressTest() {
-        // Should contain 30 characters
-        char[] symbols = "abcdefghijklmnopqrstuvwxyz!@#$".toCharArray();
-        long i = 0;
-        for (char a : symbols) {
-            for (char b : symbols) {
-                for (char c : symbols) {
-                    for (char d : symbols) {
-                        Character[] word = new Character[]{a, b, c, d};
-                        STUDENT.insert(new AlphabeticString(word), "" + i);
-                        i += 1;
-                    }
-                }
-            }
-        }
-
-        for (char a : symbols) {
-            for (char b : symbols) {
-                assertTrue(STUDENT.findPrefix(new AlphabeticString(new Character[]{a, b})));
-            }
-        }
-
-        i = 0;
-        for (char a : symbols) {
-            for (char b : symbols) {
-                for (char c : symbols) {
-                    for (char d : symbols) {
-                        Character[] word = new Character[]{a, b, c, d};
-                        assertEquals("" + i, STUDENT.find(new AlphabeticString(word)));
-                        i += 1;
-                    }
-                }
-            }
-        }
-    }
-
     /**
      * Converts a String into an AlphabeticString
      */
diff --git a/src/test/java/ckpt2/HeapSortTests.java b/src/test/java/ckpt2/HeapSortTests.java
index 577a9aa..29734e1 100644
--- a/src/test/java/ckpt2/HeapSortTests.java
+++ b/src/test/java/ckpt2/HeapSortTests.java
@@ -12,7 +12,7 @@ public class HeapSortTests {
 
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void integer_sorted() {
+	public void test_sort_integerSorted_correctSort() {
 		Integer[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
 		Integer[] arr_sorted = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
 		HeapSort.sort(arr, Integer::compareTo);
@@ -22,7 +22,7 @@ public class HeapSortTests {
 	}
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void integer_random() {
+	public void test_sort_integerRandom_correctSort() {
 		Integer[] arr = {3, 1, 4, 5, 9, 2, 6, 7, 8};
 		Integer[] arr_sorted = {1, 2, 3, 4, 5, 6, 7, 8, 9};
 		HeapSort.sort(arr, Integer::compareTo);
diff --git a/src/test/java/ckpt2/MinFourHeapTests.java b/src/test/java/ckpt2/MinFourHeapTests.java
index 6d81bac..cead8ad 100644
--- a/src/test/java/ckpt2/MinFourHeapTests.java
+++ b/src/test/java/ckpt2/MinFourHeapTests.java
@@ -15,35 +15,27 @@ import java.util.concurrent.TimeUnit;
 import static org.junit.jupiter.api.Assertions.*;
 
 public class MinFourHeapTests {
-    private static Random RAND;
-    protected static WorkList<String> STUDENT_STR;
-    protected static WorkList<Double> STUDENT_DOUBLE;
-    protected static WorkList<Integer> STUDENT_INT;
-
-    @BeforeEach
-    public void init() {
-        STUDENT_STR = new MinFourHeap<>(String::compareTo);
-        STUDENT_DOUBLE = new MinFourHeap<>(Double::compareTo);
-        STUDENT_INT = new MinFourHeap<>(Integer::compareTo);
-        RAND = new Random(42);
-    }
+    private static final int SEED = 42;
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testHasWork() {
+    public void test_hasWork_empty_noWork() {
+        WorkList<Integer> STUDENT_INT = new MinFourHeap<>(Integer::compareTo);
         assertFalse(STUDENT_INT.hasWork());
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testHasWorkAfterAdd() {
+    public void test_hasWork_oneElement_hasWork() {
+        WorkList<Integer> STUDENT_INT = new MinFourHeap<>(Integer::compareTo);
         STUDENT_INT.add(1);
         assertTrue(STUDENT_INT.hasWork());
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testHasWorkAfterAddRemove() {
+    public void test_addNextHasWork_manyElements_noWork() {
+        WorkList<Double> STUDENT_DOUBLE = new MinFourHeap<>(Double::compareTo);
         for (int i = 0; i < 1000; i++) {
             STUDENT_DOUBLE.add(Math.random());
         }
@@ -54,24 +46,35 @@ public class MinFourHeapTests {
     }
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testPeekHasException() {
-        assertTrue(doesPeekThrowException(STUDENT_INT));
+    public void test_peek_fewElements_throwsException() {
+        WorkList<Integer> STUDENT_INT = new MinFourHeap<>(Integer::compareTo);
+        assertThrows(NoSuchElementException.class, () -> {
+            STUDENT_INT.peek();
+        });
 
         addAndRemove(STUDENT_INT, 42, 10);
-        assertTrue(doesPeekThrowException(STUDENT_INT));
+        assertThrows(NoSuchElementException.class, () -> {
+            STUDENT_INT.peek();
+        });
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testNextHasException() {
-        assertTrue(doesNextThrowException(STUDENT_INT));
+    public void test_next_fewElements_throwsException() {
+        WorkList<Integer> STUDENT_INT = new MinFourHeap<>(Integer::compareTo);
+        assertThrows(NoSuchElementException.class, () -> {
+            STUDENT_INT.next();
+        });
 
         addAndRemove(STUDENT_INT, 42, 10);
-        assertTrue(doesNextThrowException(STUDENT_INT));
+        assertThrows(NoSuchElementException.class, () -> {
+            STUDENT_INT.next();
+        });
     }
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testClear() {
+    public void test_clear_fewElements_empty() {
+        WorkList<String> STUDENT_STR = new MinFourHeap<>(String::compareTo);
         addAll(STUDENT_STR, new String[]{"Beware", "the", "Jabberwock", "my", "son!"});
 
         assertTrue(STUDENT_STR.hasWork());
@@ -80,13 +83,17 @@ public class MinFourHeapTests {
         STUDENT_STR.clear();
         assertFalse(STUDENT_STR.hasWork());
         assertEquals(0, STUDENT_STR.size());
-        assertTrue(doesPeekThrowException(STUDENT_STR));
-        assertTrue(doesNextThrowException(STUDENT_STR));
+        assertThrows(NoSuchElementException.class, () -> {
+            STUDENT_STR.peek();
+        });
+        assertThrows(NoSuchElementException.class, () -> {
+            STUDENT_STR.next();
+        });
     }
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testHeapWith5Items() {
+    public void test_addNext_fewElements_correctStructure() {
         PriorityWorkList<String> heap = new MinFourHeap<>(String::compareTo);
         String[] tests = { "a", "b", "c", "d", "e" };
         for (int i = 0; i < 5; i++) {
@@ -103,7 +110,7 @@ public class MinFourHeapTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testOrderingDoesNotMatter() {
+    public void test_addPeekNext_differentOrderings_correctStructure() {
         PriorityWorkList<String> ordered = new MinFourHeap<>(String::compareTo);
         PriorityWorkList<String> reversed = new MinFourHeap<>(String::compareTo);
         PriorityWorkList<String> random = new MinFourHeap<>(String::compareTo);
@@ -129,7 +136,7 @@ public class MinFourHeapTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testHugeHeap() {
+    public void test_addNext_manyElements_correctStructure() {
         PriorityWorkList<String> heap = new MinFourHeap<>(String::compareTo);
         int n = 10000;
 
@@ -147,7 +154,8 @@ public class MinFourHeapTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void testWithCustomComparable() {
+    public void test_customComparator_manyElements_correctStructure() {
+        Random RAND = new Random(SEED);
         PriorityWorkList<Coordinate> student = new MinFourHeap<>(Coordinate::compareTo);
         Queue<Coordinate> reference = new PriorityQueue<>();
 
@@ -166,7 +174,7 @@ public class MinFourHeapTests {
 
     @Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-    public void checkStructure() {
+    public void test_addNext_severalElements_correctStructure() {
         PriorityWorkList<Integer> heap = new MinFourHeap<>(Integer::compareTo);
         addAll(heap, new Integer[] {10, 10, 15, 1, 17, 16, 100, 101, 102, 103, 105, 106, 107, 108});
 
@@ -231,24 +239,6 @@ public class MinFourHeapTests {
         }
     }
 
-    protected static <E> boolean doesPeekThrowException(WorkList<E> worklist) {
-        try {
-            worklist.peek();
-        } catch (NoSuchElementException e) {
-            return true;
-        }
-        return false;
-    }
-
-    protected static <E> boolean doesNextThrowException(WorkList<E> worklist) {
-        try {
-            worklist.next();
-        } catch (NoSuchElementException e) {
-            return true;
-        }
-        return false;
-    }
-
     protected <T> T getField(Object o, String fieldName) {
         try {
             Field field = o.getClass().getSuperclass().getDeclaredField(fieldName);
diff --git a/src/test/java/ckpt2/QuickSortTests.java b/src/test/java/ckpt2/QuickSortTests.java
index 43ae7fe..7a6101b 100644
--- a/src/test/java/ckpt2/QuickSortTests.java
+++ b/src/test/java/ckpt2/QuickSortTests.java
@@ -12,7 +12,7 @@ public class QuickSortTests {
 
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void integer_sorted() {
+	public void test_sort_integerSorted_correctSort() {
 		Integer[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
 		Integer[] arr_sorted = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
 		QuickSort.sort(arr, Integer::compareTo);
@@ -23,7 +23,7 @@ public class QuickSortTests {
 
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void integer_random() {
+	public void test_sort_integerRandom_correctSort() {
 		Integer[] arr = {3, 1, 4, 5, 9, 2, 6, 7, 8};
 		Integer[] arr_sorted = {1, 2, 3, 4, 5, 6, 7, 8, 9};
 		QuickSort.sort(arr, Integer::compareTo);
diff --git a/src/test/java/ckpt2/TopKSortTests.java b/src/test/java/ckpt2/TopKSortTests.java
index e340f98..f0a52f3 100644
--- a/src/test/java/ckpt2/TopKSortTests.java
+++ b/src/test/java/ckpt2/TopKSortTests.java
@@ -12,7 +12,7 @@ public class TopKSortTests {
 
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void integer_sorted() {
+	public void test_sort_integerSorted_correctSort() {
 		int K = 4;
 		Integer[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
 		Integer[] arr_sorted = {7, 8, 9, 10};
@@ -24,7 +24,7 @@ public class TopKSortTests {
 
 	@Test()
     @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
-	public void integer_random() {
+	public void test_sort_integerRandom_correctSort() {
 		int K = 4;
 		Integer[] arr = {3, 1, 4, 5, 9, 2, 6, 7, 8};
 		Integer[] arr_sorted = {6, 7, 8, 9};
-- 
GitLab