package net.sf.kerner.utils.collections.list.impl;

import static org.junit.Assert.*;

import java.util.Arrays;
import java.util.List;

import net.sf.kerner.utils.collections.list.impl.ListUtils;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

public class TestListUtils {

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public final void testMeld01() {
		List<String> l1 = Arrays.asList("a", "b");
		List<String> l2 = Arrays.asList("c", "d");
		List<String> l3 = Arrays.asList("a", "c", "b", "d");
		assertArrayEquals(l3.toArray(), ListUtils.meld(l1, l2, true).toArray());
	}
	
	@Test
	public final void testMeld02() {
		List<String> l1 = Arrays.asList("a", "b");
		List<String> l2 = Arrays.asList("a", "c");
		List<String> l3 = Arrays.asList("a", "b", "c");
		assertArrayEquals(l3.toArray(), ListUtils.meld(l1, l2, true).toArray());
	}
	
	@Test
	public final void testMeld03() {
		List<String> l1 = Arrays.asList("a", "b");
		List<String> l2 = Arrays.asList("a", "c");
		List<String> l3 = Arrays.asList("a", "b", "c");
		assertArrayEquals(l3.toArray(), ListUtils.meld(l1, l2, true).toArray());
	}
	
	@Test
	public final void testMeld04() {
		List<String> l1 = Arrays.asList("a", "b");
		List<String> l2 = Arrays.asList(null, "c");
		List<String> l3 = Arrays.asList("a", null, "b", "c");
		assertArrayEquals(l3.toArray(), ListUtils.meld(l1, l2, true).toArray());
	}
	
	@Test
	public final void testMeld04b() {
		List<String> l1 = Arrays.asList("a", "b");
		List<String> l2 = Arrays.asList(null, "c");
		List<String> l3 = Arrays.asList("a", "b", "c");
		assertArrayEquals(l3.toArray(), ListUtils.meld(l1, l2, false).toArray());
	}
	
	@Test
	public final void testMeld05() {
		List<String> l1 = Arrays.asList(null, null);
		List<String> l2 = Arrays.asList(null, null);
		List<String> l3 = Arrays.asList(null, null);
		assertArrayEquals(l3.toArray(), ListUtils.meld(l1, l2, true).toArray());
	}
	
	@Test
	public final void testMeld05b() {
		List<String> l1 = Arrays.asList(null, null);
		List<String> l2 = Arrays.asList(null, null);
		List<String> l3 = Arrays.asList();
		assertArrayEquals(l3.toArray(), ListUtils.meld(l1, l2, false).toArray());
	}
	
	@Test
	public final void testMeld06() {
		List<String> l1 = Arrays.asList(null, null);
		List<String> l2 = Arrays.asList("a", null);
		List<String> l3 = Arrays.asList(null, "a", null);
		assertArrayEquals(l3.toArray(), ListUtils.meld(l1, l2, true).toArray());
	}
	
	@Test
	public final void testMeld06b() {
		List<String> l1 = Arrays.asList(null, null);
		List<String> l2 = Arrays.asList("a", null);
		List<String> l3 = Arrays.asList("a");
		assertArrayEquals(l3.toArray(), ListUtils.meld(l1, l2, false).toArray());
	}

	@Ignore
	@Test
	public final void testFill() {
		fail("Not yet implemented"); // TODO
	}

}

@@ -80,36 +80,64 @@
 ert.
-*;%0A%0Aimport java.util.Arrays;
+assertArrayEquals;%0Aimport static org.junit.Assert.fail;%0A
 %0Aimp
@@ -154,22 +154,23 @@
 til.
-List;%0A
+Arrays;
 %0Aimport 
 net.
@@ -169,59 +169,22 @@
 ort 
-net.sf.kerner.utils.collections.list.impl.ListUtils
+java.util.List
 ;%0A%0Ai
@@ -2985,16 +2985,336 @@
 y());%0A%09%7D
+%0A%09%0A%09@Test%0A%09public final void testMeld07() %7B%0A%09%09List%3CDouble%3E l1 = Arrays.asList(0.1, 0.2, 0.4);%0A%09%09List%3CDouble%3E l2 = Arrays.asList(null, 0.3);%0A%09%09List%3CDouble%3E l3 = Arrays.asList(0.1,0.2,0.3,0.4);%0A%09%09List%3CDouble%3E l4 = ListUtils.meld(l1, l2, false);%0A%09%09System.err.println(l4);%0A%09%09assertArrayEquals(l3.toArray(), l4.toArray());%0A%09%7D
 %0A%0A%09@Igno

Add testcase.