diff --git a/reactor-test/src/main/java/reactor/test/DefaultStepVerifierBuilder.java b/reactor-test/src/main/java/reactor/test/DefaultStepVerifierBuilder.java index 80419a80a1..e82cda9288 100644 --- a/reactor-test/src/main/java/reactor/test/DefaultStepVerifierBuilder.java +++ b/reactor-test/src/main/java/reactor/test/DefaultStepVerifierBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2018 Pivotal Software Inc, All Rights Reserved. + * Copyright (c) 2011-2019 Pivotal Software Inc, All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1307,7 +1307,7 @@ boolean onCollect(Signal actualSignal) { this.completeLatch.countDown(); return true; } - return true; + return false; } @SuppressWarnings("unchecked") diff --git a/reactor-test/src/test/java/reactor/test/StepVerifierTests.java b/reactor-test/src/test/java/reactor/test/StepVerifierTests.java index a573c56ffd..827151de80 100644 --- a/reactor-test/src/test/java/reactor/test/StepVerifierTests.java +++ b/reactor-test/src/test/java/reactor/test/StepVerifierTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2017 Pivotal Software Inc, All Rights Reserved. + * Copyright (c) 2011-2019 Pivotal Software Inc, All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1220,6 +1220,50 @@ public void testThenConsumeWhileFails() { .withMessageContaining("expectNext(9)"); } + @Test + public void testExpectRecordedMatches() { + List expected = Arrays.asList(1,2); + + StepVerifier.create(Flux.just(1,2)) + .recordWith(ArrayList::new) + .thenConsumeWhile(i -> i < 2) + .expectRecordedMatches(expected::equals) + .thenCancel() + .verify(); + } + + @Test + public void testExpectRecordedMatchesTwice() { + List expected1 = Arrays.asList(1,2); + List expected2 = Arrays.asList(3,4); + + StepVerifier.create(Flux.just(1,2,3,4)) + .recordWith(ArrayList::new) + .thenConsumeWhile(i -> i < 2) + .expectRecordedMatches(expected1::equals) + .recordWith(ArrayList::new) + .thenConsumeWhile(i -> i < 4) + .expectRecordedMatches(expected2::equals) + .thenCancel() + .verify(); + } + + @Test + public void testExpectRecordedMatchesWithoutComplete() { + List expected = Arrays.asList(1,2); + + TestPublisher publisher = TestPublisher.createCold(); + publisher.next(1); + publisher.next(2); + + StepVerifier.create(publisher) + .recordWith(ArrayList::new) + .thenConsumeWhile(i -> i < 2) + .expectRecordedMatches(expected::equals) + .thenCancel() + .verify(); + } + @Test public void testWithDescription() { assertThatExceptionOfType(AssertionError.class)