Skip to content
Snippets Groups Projects
Commit 15eb43fb authored by Nelson Tavares de Sousa's avatar Nelson Tavares de Sousa
Browse files

added one test method

parent bc82d235
No related branches found
No related tags found
No related merge requests found
......@@ -59,7 +59,6 @@ public final class Merger<T> extends AbstractStage {
if (token == null) {
returnNoElement();
}
outputPort.send(token);
}
......
wiki @ 63ccbbc8
Subproject commit 0e4474577e1f49bc96e734c286b2d9e0363895e8
Subproject commit 63ccbbc87bd2c0e6599ca91502149dba3cfb99de
......@@ -16,13 +16,20 @@
package teetime.stage.basic.merger;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import teetime.framework.pipe.IPipeFactory;
import teetime.framework.pipe.SingleElementPipeFactory;
import teetime.framework.test.StageTester;
import teetime.stage.CollectorSink;
import teetime.stage.InitialElementProducer;
......@@ -72,4 +79,17 @@ public class MergerTest {
assertThat(this.collector.getElements(), contains(1, 2, 3));
}
@Test
public void roundRobinShouldWork2() {
mergerUnderTest = new Merger<Integer>();
mergerUnderTest.setStrategy(new RoundRobinStrategy());
List<Integer> outputList = new ArrayList<Integer>();
StageTester.test(mergerUnderTest).and().send(1, 2, 3).to(mergerUnderTest.getNewInputPort())
.and().send(4, 5, 6).to(mergerUnderTest.getNewInputPort())
.and().receive(outputList);
assertThat(outputList, is(not(empty())));
assertThat(outputList, contains(1, 2, 3, 4, 5, 6));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment