package com.growingwiththeweb.datastructures;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertSame;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

public abstract class BaseHeapTest {
    protected HeapInterface heap;

    @Before
    public abstract void setUp();

    @After
    public void tearDown() {
        heap = null;
    }

    @Test
    public void testInsert() {
        heap.insert(1);
        heap.insert(2);
        heap.insert(3);
        heap.insert(4);
        heap.insert(5);
        assertEquals(heap.size(), 5);
    }

    @Test
    public void testExtractMinimumWithEmptyHeap() {
        assertEquals(heap.extractMin(), null);
    }

    @Test
    public void testExtractMinimumItems() {
        heap.insert(5);
        heap.insert(3);
        heap.insert(4);
        heap.insert(1);
        heap.insert(2);
        assertSame(heap.extractMin(), 1);
        assertSame(heap.extractMin(), 2);
        assertSame(heap.extractMin(), 3);
        assertSame(heap.extractMin(), 4);
        assertSame(heap.extractMin(), 5);
    }
}

@@ -85,16 +85,60 @@
 Equals;%0A
+import static org.junit.Assert.assertFalse;%0A
 import s
@@ -1278,11 +1278,1238 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void testExtractMinimumFromJumbledHeap() %7B%0A        heap.insert(1);%0A        heap.insert(4);%0A        heap.insert(3);%0A        heap.insert(5);%0A        heap.insert(2);%0A        assertSame(heap.extractMin(), 1);%0A        assertSame(heap.extractMin(), 2);%0A        assertSame(heap.extractMin(), 3);%0A        assertSame(heap.extractMin(), 4);%0A        assertSame(heap.extractMin(), 5);%0A    %7D%0A%0A    @Test%0A    public void testExtractMinimumWithNegativeItems() %7B%0A        heap.insert(-9);%0A        heap.insert(6);%0A        heap.insert(3);%0A        heap.insert(10);%0A        heap.insert(-4);%0A        assertSame(heap.extractMin(), -9);%0A        assertSame(heap.extractMin(), -4);%0A        assertSame(heap.extractMin(), 3);%0A        assertSame(heap.extractMin(), 6);%0A        assertSame(heap.extractMin(), 10);%0A    %7D%0A%0A    @Test%0A    public void testFindMinimum() %7B%0A        heap.insert(5);%0A        heap.insert(3);%0A        heap.insert(1);%0A        heap.insert(4);%0A        heap.insert(2);%0A        assertSame(heap.min(), 1);%0A    %7D%0A%0A    @Test%0A    public void testIsEmpty() %7B%0A        assertTrue(heap.isEmpty());%0A        heap.insert(1);%0A        assertFalse(heap.isEmpty());%0A        heap.extractMin();%0A        assertTrue(heap.isEmpty());%0A    %7D
 %0A%7D%0A

Add more heap tests