Skip to content

Commit

Permalink
Java-75 update intro to reactor core (eugenp#9953)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
Maiklins and mikr authored Aug 31, 2020
1 parent c5d6228 commit ec65716
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion reactor-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.reactor;
package com.baeldung.reactor.introduction;

import org.junit.Test;
import org.reactivestreams.Subscriber;
Expand All @@ -15,7 +15,7 @@
public class ReactorIntegrationTest {

@Test
public void givenFlux_whenSubscribing_thenStream() throws InterruptedException {
public void givenFlux_whenSubscribing_thenStream() {

List<Integer> elements = new ArrayList<>();

Expand Down Expand Up @@ -48,14 +48,12 @@ public void givenFlux_whenZipping_thenCombine() {
}

@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;
Expand All @@ -81,11 +79,10 @@ public void onError(final Throwable t) {

@Override
public void onComplete() {
int ham = 2;
}
});

assertThat(elements).containsExactly(2, 4, 6, 8);
assertThat(elements).containsExactly(1, 2, 3, 4);
}

@Test
Expand Down

0 comments on commit ec65716

Please sign in to comment.