Skip to content

Commit

Permalink
fix a test to take cumulative hooks into account
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbasle authored Jul 3, 2017
1 parent 6cff89d commit aa6f14a
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions reactor-core/src/test/java/reactor/HooksTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,14 @@ public void verboseExtension() {

simpleFlux();

Assert.assertArrayEquals(q.toArray(),
new String[]{"FluxJust: 1", "{ \"operator\" : \"MapFuseable\" }: 2",
"{ \"operator\" : \"PeekFuseable\" }! false",
"{ \"operator\" : \"CollectList\" }! true", "MonoJust: [2]",
"{ \"operator\" : \"OnErrorResume\" }: [2]"});
assertThat(q.toArray()).containsExactly(
"FluxJust: 1", "{ \"operator\" : \"MapFuseable\" }: 2",
"{ \"operator\" : \"PeekFuseable\" }! false",
"{ \"operator\" : \"CollectList\" }! true", "MonoJust: [2]",
"{ \"operator\" : \"OnErrorResume\" }: [2]");

q.clear();
Hooks.resetOnOperator();

Hooks.onOperator(hooks -> hooks.log("reactor", true)
.doOnEach(d -> q.offer(hooks.publisher() + ": " + d),
Expand All @@ -264,19 +265,20 @@ public void verboseExtension() {

simpleFlux();

Assert.assertArrayEquals(q.toArray(),
new String[]{"FluxJust: 1", "{ \"operator\" : \"MapFuseable\" }: 2",
"{ \"operator\" : \"PeekFuseable\" }! false",
"{ \"operator\" : \"CollectList\" }! false", "MonoJust: [2]",
"{ \"operator\" : \"OnErrorResume\" }: [2]"});
assertThat(q.toArray()).containsExactly(
"FluxJust: 1", "{ \"operator\" : \"MapFuseable\" }: 2",
"{ \"operator\" : \"PeekFuseable\" }! false",
"{ \"operator\" : \"CollectList\" }! false", "MonoJust: [2]",
"{ \"operator\" : \"OnErrorResume\" }: [2]");

q.clear();
Hooks.resetOnOperator();

Hooks.onOperator(hooks -> hooks.log("reactor"));

simpleFlux();

Assert.assertArrayEquals(q.toArray(), new String[0]);
assertThat(q.toArray()).isEmpty();

q.clear();

Expand Down

0 comments on commit aa6f14a

Please sign in to comment.