Sha256: fa135c4edcdebf7145197edc94d3f689eacb058a99eae87590c0a8599142308f

Contents?: true

Size: 1.73 KB

Versions: 11

Compression:

Stored size: 1.73 KB

Contents

package com.xnlogic.pacer.pipes;

import static org.junit.Assert.*;
import org.junit.Test;
import com.tinkerpop.blueprints.Contains;
import java.util.Collection;
import java.util.Arrays;
import java.util.ArrayList;
import com.xnlogic.pacer.pipes.CollectionFilterPipe;

public class CollectionFilterPipeTest {
    @Test
    public void filterInTest() {
        Collection<String> collection = Arrays.asList("Pacer", "Pipes", "XNLogic");
        Collection<String> starts = Arrays.asList("Pacer", "XNLogic");
        Collection<String> result = new ArrayList<String>();
        CollectionFilterPipe<String> collectionFilterPipe = new CollectionFilterPipe<String>(collection, Contains.IN);

        collectionFilterPipe.setStarts(starts);

        while (collectionFilterPipe.hasNext()) {
            result.add(collectionFilterPipe.next());
        }

        assertEquals(2, result.size());
        assertTrue(result.contains("Pacer"));
        assertTrue(result.contains("XNLogic"));
        assertFalse(result.contains("Pipes"));
    }

    @Test
    public void filterNotInTest() {
        Collection<String> collection = Arrays.asList("Pacer", "Pipes", "XNLogic");
        Collection<String> starts = Arrays.asList("Pacer", "Java");
        Collection<String> result = new ArrayList<String>();
        CollectionFilterPipe<String> collectionFilterPipe = new CollectionFilterPipe<String>(collection, Contains.NOT_IN);

        collectionFilterPipe.setStarts(starts);

        while (collectionFilterPipe.hasNext()) {
            result.add(collectionFilterPipe.next());
        }

        assertEquals(1, result.size());
        assertFalse(result.contains("Pacer"));
        assertTrue(result.contains("Java"));
    }

    // TODO: Test other constructor version.
}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pacer-2.0.24-java ext/src/test/java/com/xnlogic/pacer/pipes/CollectionFilterPipeTest.java
pacer-2.0.22-java ext/src/test/java/com/xnlogic/pacer/pipes/CollectionFilterPipeTest.java
pacer-2.0.20-java ext/src/test/java/com/xnlogic/pacer/pipes/CollectionFilterPipeTest.java
pacer-2.0.19-java ext/src/test/java/com/xnlogic/pacer/pipes/CollectionFilterPipeTest.java
pacer-2.0.18-java ext/src/test/java/com/xnlogic/pacer/pipes/CollectionFilterPipeTest.java
pacer-2.0.17-java ext/src/test/java/com/xnlogic/pacer/pipes/CollectionFilterPipeTest.java
pacer-2.0.16-java ext/src/test/java/com/xnlogic/pacer/pipes/CollectionFilterPipeTest.java
pacer-2.0.15-java ext/src/test/java/com/xnlogic/pacer/pipes/CollectionFilterPipeTest.java
pacer-2.0.14-java ext/src/test/java/com/xnlogic/pacer/pipes/CollectionFilterPipeTest.java
pacer-2.0.13-java ext/src/test/java/com/xnlogic/pacer/pipes/CollectionFilterPipeTest.java
pacer-2.0.12-java ext/src/test/java/com/xnlogic/pacer/pipes/CollectionFilterPipeTest.java