package de.fau.osr.gui.util.filtering;

import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Iterables;
import de.fau.osr.gui.Model.DataElements.Requirement;
import junit.framework.TestCase;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

/**
 * @author Taleh Didover
 */
public class FilterByExactStringTest extends TestCase {

    public void setUp() throws Exception {
        super.setUp();

    }

    public void tearDown() throws Exception {

    }

    public void test_SimpleFiltering() throws Exception {
        Collection<Requirement> testdatas = new ArrayList<>();
        for (String word : "Java ist auch eine Insel".split(" ")) {
            testdatas.add(new Requirement(word));
        }
        Predicate<Requirement> filtering = new FilterByExactString("Java");

        Collection<Requirement> expected = Arrays.asList(new Requirement("Java"));
        Collection<Requirement> got = Collections2.filter(testdatas, filtering);
        assertTrue(Iterables.elementsEqual(expected, got));
    }

    public void test_NoFiltering() throws Exception {
        Collection<Requirement> testdatas = new ArrayList<>();

        for (String word : "Java ist auch eine Insel".split(" ")) {
            testdatas.add(new Requirement(word));
        }
        Predicate<Requirement> filtering = new FilterByExactString("");


        Collection<Requirement> expected = new ArrayList<>(testdatas);
        Collection<Requirement> got = Collections2.filter(testdatas, filtering);
        assertTrue(Iterables.elementsEqual(expected, got));
    }
}
@@ -230,32 +230,22 @@
 ort 
+org.
 junit.
-framework.TestCase
+Test
 ;%0A%0Ai
@@ -326,16 +326,60 @@
 ction;%0A%0A
+import static org.junit.Assert.assertTrue;%0A%0A
 /**%0A * @
@@ -444,155 +444,20 @@
 est 
-extends TestCase %7B%0A%0A    public void setUp() throws Exception %7B%0A        super.setUp();%0A%0A    %7D%0A%0A    public void tearDown() throws Exception %7B%0A%0A    %7D%0A
+%7B%0A%0A    @Test
 %0A   
@@ -1010,16 +1010,26 @@
 %0A    %7D%0A%0A
+    @Test%0A
     publ

make test for JUnit 4