import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.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; @BeforeAll 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() { Assertions.assertEquals(opl1, merger.mergeA(Collections.unmodifiableList(input1)), "mergeA werkt niet correct."); } @Test public void test1B() { Assertions.assertEquals(opl1, merger.mergeB(Collections.unmodifiableList(input1)), "mergeB werkt niet correct."); } @Test public void test1C() { Assertions.assertEquals(opl1, merger.mergeC(Collections.unmodifiableList(input1)), "mergeC werkt niet correct."); } @Test public void test2A() { Assertions.assertEquals(opl2, Collections.unmodifiableList(merger.mergeA(input2)), "mergeA werkt niet correct."); } @Test public void test2B() { Assertions.assertEquals(opl2, merger.mergeB(Collections.unmodifiableList(input2)), "mergeB werkt niet correct."); } @Test public void test2C() { Assertions.assertEquals(opl2, merger.mergeC(Collections.unmodifiableList(input2)), "mergeC werkt niet correct."); } @Test public void testLeegA() { Assertions.assertEquals(Collections.emptyList(), merger.mergeA(Collections.emptyList()), "mergeA werkt niet correct op een lege lijst."); } @Test public void testLeegB() { Assertions.assertEquals(Collections.emptyList(), merger.mergeA(Collections.emptyList()), "mergeB werkt niet correct op een lege lijst."); } @Test public void testLeegC() { Assertions.assertEquals(Collections.emptyList(), merger.mergeA(Collections.emptyList()), "mergeC werkt niet correct op een lege lijst."); } }