import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import java.util.Arrays; import java.util.Collections; import java.util.List; public class SimpleTest { private static Merge merger; private static List> input1; private static List opl1; private static List> input2; private static List opl2; @BeforeClass public static void init() { merger = new KWayMerge(); input1 = Arrays.asList(Arrays.asList(1, 2, 5, 8, 9), Arrays.asList(2, 6, 7, 9, 10)); opl1 = Arrays.asList(1, 2, 2, 5, 6, 7, 8, 9, 9, 10); input2 = Arrays.asList( Arrays.asList(14, 24, 32, 35, 48, 67), Arrays.asList(12, 15, 23, 28, 36, 49, 78, 99), Arrays.asList(2, 5, 10, 26, 48, 53), Arrays.asList(10, 18, 32, 45, 59, 78, 102, 106), Arrays.asList(6, 24, 36, 48, 60, 66, 72) ); opl2 = Arrays.asList(2, 5, 6, 10, 10, 12, 14, 15, 18, 23, 24, 24, 26, 28, 32, 32, 35, 36, 36, 45, 48, 48, 48, 49, 53, 59, 60, 66, 67, 72, 78, 78, 99, 102, 106); } @Test public void test1A() { Assert.assertEquals("mergeA werkt niet correct.", opl1, merger.mergeA(Collections.unmodifiableList(input1))); } @Test public void test1B() { Assert.assertEquals("mergeB werkt niet correct.", opl1, merger.mergeB(Collections.unmodifiableList(input1))); } @Test public void test1C() { Assert.assertEquals("mergeC werkt niet correct.", opl1, merger.mergeC(Collections.unmodifiableList(input1))); } @Test public void test2A() { Assert.assertEquals("mergeA werkt niet correct.", opl2, Collections.unmodifiableList(merger.mergeA(input2))); } @Test public void test2B() { Assert.assertEquals("mergeB werkt niet correct.", opl2, merger.mergeB(Collections.unmodifiableList(input2))); } @Test public void test2C() { Assert.assertEquals("mergeC werkt niet correct.", opl2, merger.mergeC(Collections.unmodifiableList(input2))); } @Test public void testLeegA() { Assert.assertEquals("mergeA werkt niet correct op een lege lijst.", Collections.emptyList(), merger.mergeA(Collections.emptyList())); } @Test public void testLeegB() { Assert.assertEquals("mergeB werkt niet correct op een lege lijst.", Collections.emptyList(), merger.mergeA(Collections.emptyList())); } @Test public void testLeegC() { Assert.assertEquals("mergeC werkt niet correct op een lege lijst.", Collections.emptyList(), merger.mergeA(Collections.emptyList())); } }