From 9ff48a96d1aee453d6bdb16c3d670657843034b2 Mon Sep 17 00:00:00 2001 From: Christian Wulf <chw@informatik.uni-kiel.de> Date: Tue, 3 Mar 2015 18:15:37 +0100 Subject: [PATCH] added assertions --- .../filter/AnomalyDetectionFilterTest.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/test/java/teetime/stage/opad/filter/AnomalyDetectionFilterTest.java b/src/test/java/teetime/stage/opad/filter/AnomalyDetectionFilterTest.java index 3fffb0bc..a8eef115 100644 --- a/src/test/java/teetime/stage/opad/filter/AnomalyDetectionFilterTest.java +++ b/src/test/java/teetime/stage/opad/filter/AnomalyDetectionFilterTest.java @@ -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)); } -- GitLab