use of org.apache.samza.operators.TestMessageStreamImplUtil in project samza by apache.
the class TestOperatorSpecs method testCreateMergeOperator.
@Test
public void testCreateMergeOperator() {
StreamGraphImpl mockGraph = mock(StreamGraphImpl.class);
MessageStreamImpl<TestMessageEnvelope> output = TestMessageStreamImplUtil.<TestMessageEnvelope>getMessageStreamImpl(mockGraph);
StreamOperatorSpec<TestMessageEnvelope, TestMessageEnvelope> mergeOp = OperatorSpecs.createMergeOperatorSpec(output, 1);
Function<TestMessageEnvelope, Collection<TestMessageEnvelope>> mergeFn = t -> new ArrayList<TestMessageEnvelope>() {
{
this.add(t);
}
};
TestMessageEnvelope t = mock(TestMessageEnvelope.class);
assertEquals(mergeOp.getTransformFn().apply(t), mergeFn.apply(t));
assertEquals(mergeOp.getNextStream(), output);
}
Aggregations