Java-75 update intro to reactor core (#9953)

* Java-75 Update intro to Reactor Core

* Java-75 Create package for introduction

* Java-75 Update reactor version and align unit test with article

Co-authored-by: mikr <michael.krimgen@ximedes.com>
This commit is contained in:
Maiklins 2020-08-31 19:41:46 +02:00 committed by GitHub
parent 25b1749308
commit d237c52a1f
2 changed files with 5 additions and 8 deletions

View File

@ -34,7 +34,7 @@
</dependencies>
<properties>
<reactor.version>3.2.6.RELEASE</reactor.version>
<reactor.version>3.3.9.RELEASE</reactor.version>
<assertj.version>3.6.1</assertj.version>
</properties>

View File

@ -1,4 +1,4 @@
package com.baeldung.reactor;
package com.baeldung.reactor.introduction;
import org.junit.Test;
import org.reactivestreams.Subscriber;
@ -15,7 +15,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class ReactorIntegrationTest {
@Test
public void givenFlux_whenSubscribing_thenStream() throws InterruptedException {
public void givenFlux_whenSubscribing_thenStream() {
List<Integer> elements = new ArrayList<>();
@ -48,14 +48,12 @@ public class ReactorIntegrationTest {
}
@Test
public void givenFlux_whenApplyingBackPressure_thenPushElementsInBatches() throws InterruptedException {
public void givenFlux_whenApplyingBackPressure_thenPushElementsInBatches() {
List<Integer> elements = new ArrayList<>();
Flux.just(1, 2, 3, 4)
.log()
.map(i -> i * 2)
.onBackpressureBuffer()
.subscribe(new Subscriber<Integer>() {
private Subscription s;
int onNextAmount;
@ -81,11 +79,10 @@ public class ReactorIntegrationTest {
@Override
public void onComplete() {
int ham = 2;
}
});
assertThat(elements).containsExactly(2, 4, 6, 8);
assertThat(elements).containsExactly(1, 2, 3, 4);
}
@Test