Skip to content

Commit

Permalink
Merge reactor#2706 into 3.4.7
Browse files Browse the repository at this point in the history
Conflicts primarily from tests having switched from generic array
creation to list based implementations (which we keep).
  • Loading branch information
simonbasle committed May 19, 2021
2 parents 0c0607f + b16972b commit eb94c95
Show file tree
Hide file tree
Showing 27 changed files with 117 additions and 116 deletions.
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ ext {

// Testing
jUnitPlatformVersion = '5.6.0'
assertJVersion = '3.11.1'
assertJVersion = '3.19.0' //needs to be manually synchronized in buildSrc
mockitoVersion = '2.23.0'
awaitilityVersion = '3.1.2'
throwingFunctionVersion = '1.5.0'
Expand Down Expand Up @@ -164,7 +164,6 @@ configure(subprojects) { p ->
test {
include '**/*Tests.*'
include '**/*Test.*'
include '**/*Spec.*'
}

// all test tasks will show FAILED for each test method,
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repositories {
}

dependencies {
testImplementation("org.assertj:assertj-core:3.11.1")
testImplementation("org.assertj:assertj-core:3.19.0")
testImplementation platform("org.junit:junit-bom:5.6.0")
testImplementation "org.junit.jupiter:junit-jupiter-api"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
Expand Down
43 changes: 24 additions & 19 deletions reactor-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ext {
testSets {
blockHoundTest
withMicrometerTest
tckTest
}

configurations {
Expand All @@ -57,7 +58,7 @@ configurations {
dependencies {
// Reactive Streams
api "org.reactivestreams:reactive-streams:${reactiveStreamsVersion}"
testImplementation ("org.reactivestreams:reactive-streams-tck:${reactiveStreamsVersion}") {
tckTestImplementation ("org.reactivestreams:reactive-streams-tck:${reactiveStreamsVersion}") {
// without this exclusion, testng brings an old version of junit which *embeds* an old version of hamcrest
// which gets picked up first and that we don't want. TCK runs fine w/o (old) junit 4.
exclude group: 'junit', module: 'junit'
Expand Down Expand Up @@ -185,17 +186,9 @@ task loops(type: Test, group: 'verification') {
}
}

task reactivestreamsTCK(type: Test, group: 'verification') {
include '**/*Verification.*'
doFirst {
println "Additional tests from `${name}` (${includes})"
}
}

tasks.withType(Test).all {
if (it.name == "reactivestreamsTCK") {
useTestNG()
} else {
if (it.name == "test") {
//configure tag support for the core test task
def tags = rootProject.findProperty("junit-tags")
if (tags != null) {
println "junit5 tags for core: $tags"
Expand All @@ -207,6 +200,18 @@ tasks.withType(Test).all {
useJUnitPlatform()
}
}
else if (it.name != "tckTest") {
//default to JunitPlatform
useJUnitPlatform()
}
}

tckTest {
useTestNG()
include '**/*Verification.*'
doFirst {
println "Additional tests from `${name}` (${includes})"
}
}


Expand All @@ -216,17 +221,21 @@ blockHoundTest {
maxParallelForks = 1
}

jcstress {
mode = 'quick' //quick, default, tough
}

// inherit basic test task + common configuration in root
// always depend on testNoMicrometer, skip reactivestreamsTCK on Travis, skip loops when not releasing
// always depend on withMicrometerTest, blockHoundTest and tckTest, skip loops when not releasing
// note that this way the tasks can be run individually
check {
dependsOn withMicrometerTest
if (!detectedCiServers.contains("TRAVIS")) {
dependsOn reactivestreamsTCK
}
dependsOn blockHoundTest
dependsOn tckTest
if (!version.endsWith('-SNAPSHOT') && !version.contains('-SNAPSHOT-')) { //neither classic nor customized snapshots
dependsOn loops
}
dependsOn tasks.jcstress
}

// TODO all java9 / stubs / java-specific stuff should go in a convention plugin ?
Expand All @@ -249,10 +258,6 @@ jacocoTestReport.dependsOn test
check.dependsOn jacocoTestReport
check.dependsOn japicmp

jcstress {
mode = 'quick' //quick, default, tough
}
tasks.check.dependsOn(tasks.jcstress)

if (JavaVersion.current().java9Compatible) {
// SharedSecretsCallSiteSupplierFactory is a Java 8 specific optimization.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public String toString() {
.isThrownBy(() -> {
assertThat(queueSubscription).isNull();
})
.withMessage("\n" + "Expecting:\n" + " <ThisIsNotAQueue>\n" + "to be equal to:\n" + " <null>\n" + "but was not.");
.withMessage("\n" + "expected: null\n" + "but was : ThisIsNotAQueue");
}

}
30 changes: 15 additions & 15 deletions reactor-core/src/test/java/reactor/core/ScannableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ public void taggedFluxTest() {
.hide();

final Stream<Tuple2<String, String>> scannedTags1 = Scannable.from(tagged1).tags();
assertThat(scannedTags1.iterator())
assertThat(scannedTags1)
.containsExactlyInAnyOrder(Tuples.of("1", "One"));

final Stream<Tuple2<String, String>> scannedTags2 = Scannable.from(tagged2).tags();
assertThat(scannedTags2.iterator())
assertThat(scannedTags2)
.containsExactlyInAnyOrder(Tuples.of("1", "One"), Tuples.of( "2", "Two"));
}

Expand All @@ -235,11 +235,11 @@ public void taggedHideFluxTest() {
.hide();

final Stream<Tuple2<String, String>> scannedTags1 = Scannable.from(tagged1).tags();
assertThat(scannedTags1.iterator())
assertThat(scannedTags1)
.containsExactlyInAnyOrder(Tuples.of("1", "One"));

final Stream<Tuple2<String, String>> scannedTags2 = Scannable.from(tagged2).tags();
assertThat(scannedTags2.iterator())
assertThat(scannedTags2)
.containsExactlyInAnyOrder(Tuples.of("1", "One"), Tuples.of( "2", "Two"));
}

Expand All @@ -251,7 +251,7 @@ public void taggedAppendedFluxTest() {
.tag("2", "Two");

final Stream<Tuple2<String, String>> scannedTags = Scannable.from(tagged1).tags();
assertThat(scannedTags.iterator())
assertThat(scannedTags)
.containsExactlyInAnyOrder(Tuples.of("1", "One"), Tuples.of( "2", "Two"));
}

Expand All @@ -264,7 +264,7 @@ public void taggedAppendedHideFluxTest() {
.tag("2", "Two");

final Stream<Tuple2<String, String>> scannedTags = Scannable.from(tagged1).tags();
assertThat(scannedTags.iterator())
assertThat(scannedTags)
.containsExactlyInAnyOrder(Tuples.of("1", "One"), Tuples.of( "2", "Two"));
}

Expand Down Expand Up @@ -351,11 +351,11 @@ public void taggedMonoTest() {
.hide();

final Stream<Tuple2<String, String>> scannedTags1 = Scannable.from(tagged1).tags();
assertThat(scannedTags1.iterator())
assertThat(scannedTags1)
.containsExactlyInAnyOrder(Tuples.of("1", "One"));

final Stream<Tuple2<String, String>> scannedTags2 = Scannable.from(tagged2).tags();
assertThat(scannedTags2.iterator())
assertThat(scannedTags2)
.containsExactlyInAnyOrder(Tuples.of("1", "One"), Tuples.of( "2", "Two"));
}

Expand All @@ -372,11 +372,11 @@ public void taggedHideMonoTest() {
.hide();

final Stream<Tuple2<String, String>> scannedTags1 = Scannable.from(tagged1).tags();
assertThat(scannedTags1.iterator())
assertThat(scannedTags1)
.containsExactlyInAnyOrder(Tuples.of("1", "One"));

final Stream<Tuple2<String, String>> scannedTags2 = Scannable.from(tagged2).tags();
assertThat(scannedTags2.iterator())
assertThat(scannedTags2)
.containsExactlyInAnyOrder(Tuples.of("1", "One"), Tuples.of( "2", "Two"));
}

Expand All @@ -388,7 +388,7 @@ public void taggedAppendedMonoTest() {
.tag("2", "Two");

final Stream<Tuple2<String, String>> scannedTags = Scannable.from(tagged1).tags();
assertThat(scannedTags.iterator())
assertThat(scannedTags)
.containsExactlyInAnyOrder(Tuples.of("1", "One"), Tuples.of( "2", "Two"));
}

Expand All @@ -401,7 +401,7 @@ public void taggedAppendedHideMonoTest() {
.tag("2", "Two");

final Stream<Tuple2<String, String>> scannedTags = Scannable.from(tagged1).tags();
assertThat(scannedTags.iterator())
assertThat(scannedTags)
.containsExactlyInAnyOrder(Tuples.of("1", "One"), Tuples.of( "2", "Two"));
}

Expand Down Expand Up @@ -456,10 +456,10 @@ public void taggedParallelFluxTest() {
.hide();

Stream<Tuple2<String, String>> scannedTags1 = Scannable.from(tagged1).tags();
assertThat(scannedTags1.iterator()).containsExactlyInAnyOrder(Tuples.of("1", "One"));
assertThat(scannedTags1).containsExactlyInAnyOrder(Tuples.of("1", "One"));

Stream<Tuple2<String, String>> scannedTags2 = Scannable.from(tagged2).tags();
assertThat(scannedTags2.iterator())
assertThat(scannedTags2)
.containsExactlyInAnyOrder(Tuples.of("1", "One"), Tuples.of( "2", "Two"));
}

Expand All @@ -471,7 +471,7 @@ public void taggedAppendedParallelFluxTest() {
.tag("2", "Two");

final Stream<Tuple2<String, String>> scannedTags = Scannable.from(tagged1).tags();
assertThat(scannedTags.iterator())
assertThat(scannedTags)
.containsExactlyInAnyOrder(Tuples.of("1", "One"), Tuples.of( "2", "Two"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,6 @@ public void errorModeContinueDelayErrorsWithCallable() {
}

@Test
@SuppressWarnings("unchecked")
public void errorModeContinueInternalErrorStopStrategy() {
for (int iterations = 0; iterations < 1000; iterations++) {
AtomicInteger i = new AtomicInteger();
Expand Down Expand Up @@ -1733,7 +1732,6 @@ public void errorModeContinueInternalErrorStopStrategy() {
}

@Test
@SuppressWarnings("unchecked")
public void errorModeContinueInternalErrorStopStrategyAsync() {
for (int iterations = 0; iterations < 1000; iterations++) {
AtomicInteger i = new AtomicInteger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package reactor.core.publisher;

import static org.assertj.core.api.Java6Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import java.time.Duration;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void scanOperator() throws Exception {
//noinspection unchecked
final Stream<Tuple2<String, String>> scannedTags = test.scan(Scannable.Attr.TAGS);
assertThat(scannedTags).isNotNull();
assertThat(scannedTags.iterator()).containsExactlyInAnyOrder(tag1, tag2);
assertThat(scannedTags).containsExactlyInAnyOrder(tag1, tag2);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void scanOperator() throws Exception {

final Stream<Tuple2<String, String>> scannedTags = test.scan(Scannable.Attr.TAGS);
assertThat(scannedTags).isNotNull();
assertThat(scannedTags.iterator()).containsExactlyInAnyOrder(tag1, tag2);
assertThat(scannedTags).containsExactlyInAnyOrder(tag1, tag2);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ public void parallelFluxCheckpointDescriptionAndForceStack() {
Iterator<String> lines = seekToBacktrace(debugStack);

assertThat(lines)
.toIterable()
.startsWith(
"|_ ParallelFlux.checkpoint ⇢ at reactor.core.publisher.FluxOnAssemblyTest.parallelFluxCheckpointDescriptionAndForceStack(FluxOnAssemblyTest.java:" + (baseline + 4) + ")",
"Stack trace:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static reactor.core.publisher.Sinks.EmitFailureHandler.FAIL_FAST;

@SuppressWarnings("deprecation")
public class FluxSwitchMapTest {

@ParameterizedTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -923,11 +923,12 @@ public void shouldReturnNormallyIfExceptionIsThrownOnNextDuringSwitching() {
.expectError(NullPointerException.class)
.verifyThenAssertThat(Duration.ofSeconds(5))
.hasOperatorErrorsSatisfying(c ->
assertThat(c)
.hasOnlyOneElementSatisfying(t -> {
assertThat(t.getT1()).containsInstanceOf(NullPointerException.class);
assertThat(t.getT2()).isEqualTo(expectedCause);
})
assertThat(c)
.singleElement()
.satisfies(t -> {
assertThat(t.getT1()).containsInstanceOf(NullPointerException.class);
assertThat(t.getT2()).isEqualTo(expectedCause);
})
);


Expand Down Expand Up @@ -996,7 +997,8 @@ public void shouldReturnNormallyIfExceptionIsThrownOnNextDuringSwitchingConditio
.verifyThenAssertThat()
.hasOperatorErrorsSatisfying(c ->
assertThat(c)
.hasOnlyOneElementSatisfying(t -> {
.singleElement()
.satisfies(t -> {
assertThat(t.getT1()).containsInstanceOf(NullPointerException.class);
assertThat(t.getT2()).isEqualTo(expectedCause);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package reactor.core.publisher;

import org.junit.jupiter.api.Test;
import org.testng.Assert;

import reactor.core.Exceptions;
import reactor.core.Scannable;
import reactor.test.StepVerifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void scanOperator() throws Exception {

final Stream<Tuple2<String, String>> scannedTags = test.scan(Scannable.Attr.TAGS);
assertThat(scannedTags).isNotNull();
assertThat(scannedTags.iterator()).containsExactlyInAnyOrder(tag1, tag2);
assertThat(scannedTags).containsExactlyInAnyOrder(tag1, tag2);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void scanOperator() throws Exception {

final Stream<Tuple2<String, String>> scannedTags = test.scan(Scannable.Attr.TAGS);
assertThat(scannedTags).isNotNull();
assertThat(scannedTags.iterator()).containsExactlyInAnyOrder(tag1, tag2);
assertThat(scannedTags).containsExactlyInAnyOrder(tag1, tag2);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void scanOperator() throws Exception {

final Stream<Tuple2<String, String>> scannedTags = test.scan(Scannable.Attr.TAGS);
assertThat(scannedTags).isNotNull();
assertThat(scannedTags.iterator()).containsExactlyInAnyOrder(tag1, tag2);
assertThat(scannedTags).containsExactlyInAnyOrder(tag1, tag2);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void zeroQueueOperations() {
assertThat(q.peek()).as("peek").isNull();
assertThat(q.poll()).as("poll").isNull();
assertThat(q.contains(1)).as("contains").isFalse();
assertThat(q.iterator()).as("iterator").isEmpty();
assertThat(q.iterator()).as("iterator").isExhausted();

assertThatExceptionOfType(NoSuchElementException.class)
.as("element")
Expand Down
Loading

0 comments on commit eb94c95

Please sign in to comment.