package util.list;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

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

import junit.framework.TestCase;

import org.junit.Test;

/**
 * {@link ListEx} is test class.
 * 
 * @since v0.1
 */
public class TestListEx extends TestCase {
    private static final List<String> LIST = new ArrayList<>(Arrays.asList(
            "hoge",
            "fuga",
            "piyo",
            null,
            ""));

    @Test
    public void test() {
        assertThat(ListEx.countList(LIST, null, false), is(5));
        assertThat(ListEx.countList(LIST, null, true), is(4));
        assertThat(ListEx.countList(LIST, Arrays.asList("hoge"), false), is(4));
        assertThat(ListEx.countList(LIST, Arrays.asList("hoge", "fuga"), false), is(3));
        assertThat(ListEx.countList(LIST, Arrays.asList("hoge", "fuga", "piyo"), true), is(1));
        assertThat(
                ListEx.countList(LIST, Arrays.asList("hoge", "fuga", "piyo", ""), true),
                is(0));
        assertThat(
                ListEx.countList(LIST, Arrays.asList("hoge", "fuga", "piyo", null), false),
                is(1));
        assertThat(ListEx.countList(LIST, Arrays.asList(""), false), is(4));
        assertThat(ListEx.countList(LIST, Arrays.asList(""), true), is(3));
        assertThat(ListEx.countList(LIST, Arrays.asList("", null), false), is(3));
        assertThat(ListEx.countList(null, null, false), is(0));
    }
}

@@ -57,16 +57,61 @@
 ers.is;%0A
+import static org.hamcrest.CoreMatchers.isA;%0A
 import s
@@ -155,16 +155,16 @@
 rtThat;%0A
-
 %0Aimport 
@@ -597,16 +597,27 @@
 oid test
+_countList1
 () %7B%0A   
@@ -1503,32 +1503,32 @@
 false), is(3));%0A
-
         assertTh
@@ -1580,11 +1580,558 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void test_countList2() %7B%0A        assertThat(ListEx.countList(LIST, false), is(5));%0A        assertThat(ListEx.countList(LIST, true), is(4));%0A    %7D%0A%0A    @Test%0A    public void test_toNotNullElementsList() %7B%0A        assertThat(%0A                ListEx.toNotNullElementsList(LIST),%0A                is(Arrays.asList(%22hoge%22, %22fuga%22, %22piyo%22, %22%22)));%0A    %7D%0A%0A    @Test%0A    public void test_toNotNullList() %7B%0A        assertThat(ListEx.toNotNullList(LIST), is(LIST));%0A        assertThat(ListEx.toNotNullList(null), isA(List.class));%0A    %7D
 %0A%7D%0A

Update TestListEx.java