Skip to content
Snippets Groups Projects
Commit 9ff48a96 authored by Christian Wulf's avatar Christian Wulf
Browse files

added assertions

parent 064c8b3d
No related branches found
No related tags found
No related merge requests found
......@@ -24,12 +24,15 @@ import static org.junit.Assert.assertThat;
import static teetime.framework.test.StageTester.test;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import teetime.util.Pair;
import kieker.tools.opad.record.StorableDetectionResult;
/**
......@@ -72,21 +75,31 @@ public class AnomalyDetectionFilterTest {
@Test
@Ignore("maybe a problem in; org.hamcrest.collection.IsIterableContainingInOrder.contains")
public void OutputPortAnnormalShouldForwardElements() {
test(adf).and().send(input3, input4).to(adf.getInputPort()).and().receive(resultsNormalPort).from(adf.getOutputPortNormal()).start();
test(adf).and().send(input3, input4).to(adf.getInputPort())
.and().receive(resultsNormalPort).from(adf.getOutputPortNormal())
.start();
assertEquals(0, resultsAnnormalPort.size());
test(adf).and().send(input3, input4).to(adf.getInputPort()).and().receive(resultsAnnormalPort).from(adf.getOutputPortAnnormal()).start();
test(adf).and().send(input3, input4).to(adf.getInputPort())
.and().receive(resultsAnnormalPort).from(adf.getOutputPortAnnormal())
.start();
assertThat(resultsAnnormalPort, contains(input3, input4));
}
@Test
public void bothOutputPortsShouldForwardElements() {
test(adf).and().send(input1, input2, input3, input4).to(adf.getInputPort()).and().receive(resultsNormalPort).from(adf.getOutputPortNormal()).start();
Collection<Pair<Thread, Throwable>> exceptions;
exceptions = test(adf).and().send(input1, input2, input3, input4).to(adf.getInputPort())
.and().receive(resultsNormalPort).from(adf.getOutputPortNormal())
.start();
assertThat(exceptions, is(empty()));
assertThat(resultsNormalPort, is(not(empty())));
assertThat(resultsNormalPort, contains(input1, input2));
test(adf).and().send(input1, input2, input3, input4, input5).to(adf.getInputPort()).and().receive(resultsAnnormalPort).from(adf.getOutputPortAnnormal())
exceptions = test(adf).and().send(input1, input2, input3, input4, input5).to(adf.getInputPort())
.and().receive(resultsAnnormalPort).from(adf.getOutputPortAnnormal())
.start();
assertThat(exceptions, is(empty()));
assertThat(resultsAnnormalPort, is(not(empty())));
assertThat(resultsAnnormalPort, contains(input3, input4, input5));
}
......
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