use of reactor.test.ParameterizedTestWithName in project reactor-core by reactor.
the class FluxOnAssemblyTest method checkpointWithDescriptionIsLightForParallel.
@ParameterizedTestWithName
@ValueSource(booleans = { false, true })
void checkpointWithDescriptionIsLightForParallel(boolean debugModeOn) {
if (debugModeOn) {
Hooks.onOperatorDebug();
}
StringWriter sw = new StringWriter();
Flux<Integer> tested = Flux.range(1, 10).parallel(2).transformGroups(g -> g.map(i -> (Integer) null)).checkpoint("light").sequential().doOnError(t -> t.printStackTrace(new PrintWriter(sw)));
StepVerifier.create(tested).verifyError();
String debugStack = sw.toString();
if (debugModeOn) {
// the traceback "error has been observed" contains both individual ops and light checkpoint,
// assembly points to map, with no description
assertThat(debugStack).contains("Assembly trace from producer [reactor.core.publisher.FluxMap] :").contains("*__ParallelFlux.transformGroups ⇢ at reactor.core.publisher.FluxOnAssemblyTest.checkpointWithDescriptionIsLightForParallel(").contains("checkpoint ⇢ light");
} else {
// the traceback "error has been observed" only contains the light checkpoint,
// assembly is not present
assertThat(debugStack).doesNotContain("Assembly trace from producer").contains("checkpoint ⇢ light").doesNotContain("ParallelFlux.transformGroups ⇢ at");
}
}
use of reactor.test.ParameterizedTestWithName in project reactor-core by reactor.
the class FluxOnAssemblyTest method checkpointEmptyForMono.
@ParameterizedTestWithName
@ValueSource(booleans = { false, true })
void checkpointEmptyForMono(boolean debugModeOn) {
if (debugModeOn) {
Hooks.onOperatorDebug();
}
StringWriter sw = new StringWriter();
Mono<Object> tested = Mono.just(1).map(i -> null).filter(Objects::nonNull).checkpoint().doOnError(t -> t.printStackTrace(new PrintWriter(sw)));
StepVerifier.create(tested).verifyError();
String debugStack = sw.toString();
if (debugModeOn) {
// the traceback "error has been observed" contains both individual ops and checkpoint,
// assembly points to map
assertThat(debugStack).contains("Assembly trace from producer [reactor.core.publisher.MonoMap] :").contains("Mono.filter ⇢ at reactor.core.publisher.FluxOnAssemblyTest.checkpointEmptyForMono(").contains("checkpoint() ⇢ at reactor.core.publisher.FluxOnAssemblyTest.checkpointEmptyForMono(");
} else {
// the traceback "error has been observed" only contains the checkpoint, with callsite,
// assembly points to filter
assertThat(debugStack).contains("Assembly trace from producer [reactor.core.publisher.MonoFilterFuseable] :").contains("checkpoint() ⇢ at reactor.core.publisher.FluxOnAssemblyTest.checkpointEmptyForMono(").doesNotContain("Mono.filter ⇢ at");
}
}
use of reactor.test.ParameterizedTestWithName in project reactor-core by reactor.
the class FluxOnAssemblyTest method checkpointWithDescriptionIsLightForMono.
@ParameterizedTestWithName
@ValueSource(booleans = { false, true })
void checkpointWithDescriptionIsLightForMono(boolean debugModeOn) {
if (debugModeOn) {
Hooks.onOperatorDebug();
}
StringWriter sw = new StringWriter();
Mono<Object> tested = Mono.just(1).map(i -> null).filter(Objects::nonNull).checkpoint("light").doOnError(t -> t.printStackTrace(new PrintWriter(sw)));
StepVerifier.create(tested).verifyError();
String debugStack = sw.toString();
if (debugModeOn) {
// the traceback "error has been observed" contains both individual ops and light checkpoint,
// assembly points to map, with no description
assertThat(debugStack).contains("Assembly trace from producer [reactor.core.publisher.MonoMap] :").contains("Mono.filter ⇢ at reactor.core.publisher.FluxOnAssemblyTest.checkpointWithDescriptionIsLightForMono(").contains("checkpoint ⇢ light");
} else {
// the traceback "error has been observed" only contains the light checkpoint,
// assembly is not present
assertThat(debugStack).doesNotContain("Assembly trace from producer").contains("checkpoint ⇢ light").doesNotContain("Mono.filter ⇢ at");
}
}
use of reactor.test.ParameterizedTestWithName in project reactor-core by reactor.
the class FluxOnAssemblyTest method checkpointEmptyForParallel.
@ParameterizedTestWithName
@ValueSource(booleans = { false, true })
void checkpointEmptyForParallel(boolean debugModeOn) {
if (debugModeOn) {
Hooks.onOperatorDebug();
}
StringWriter sw = new StringWriter();
Flux<Integer> tested = Flux.range(1, 10).parallel(2).transformGroups(g -> g.map(i -> (Integer) null)).checkpoint().sequential().doOnError(t -> t.printStackTrace(new PrintWriter(sw)));
StepVerifier.create(tested).verifyError();
String debugStack = sw.toString();
if (debugModeOn) {
// the traceback "error has been observed" contains both individual ops and checkpoint,
// assembly points to map
assertThat(debugStack).contains("Assembly trace from producer [reactor.core.publisher.FluxMap] :").contains("*__ParallelFlux.transformGroups ⇢ at reactor.core.publisher.FluxOnAssemblyTest.checkpointEmptyForParallel(").contains("checkpoint() ⇢ at reactor.core.publisher.FluxOnAssemblyTest.checkpointEmptyForParallel(");
} else {
// the traceback "error has been observed" only contains the checkpoint, with callsite,
// assembly points to parallelSource
assertThat(debugStack).contains("Assembly trace from producer [reactor.core.publisher.ParallelSource] :").contains("checkpoint() ⇢ at reactor.core.publisher.FluxOnAssemblyTest.checkpointEmptyForParallel(").doesNotContain("ParallelFlux.transformGroups ⇢ at");
}
}
use of reactor.test.ParameterizedTestWithName in project reactor-core by reactor.
the class FluxOnAssemblyTest method checkpointEmpty.
@ParameterizedTestWithName
@ValueSource(booleans = { false, true })
void checkpointEmpty(boolean debugModeOn) {
if (debugModeOn) {
Hooks.onOperatorDebug();
}
StringWriter sw = new StringWriter();
Flux<Integer> tested = Flux.range(1, 10).map(i -> i < 3 ? i : null).filter(i -> i % 2 == 0).checkpoint().doOnError(t -> t.printStackTrace(new PrintWriter(sw)));
StepVerifier.create(tested).expectNext(2).verifyError();
String debugStack = sw.toString();
if (debugModeOn) {
// the traceback "error has been observed" contains both individual ops and checkpoint,
// assembly points to map
assertThat(debugStack).contains("Assembly trace from producer [reactor.core.publisher.FluxMapFuseable] :").contains("Flux.filter ⇢ at reactor.core.publisher.FluxOnAssemblyTest.checkpointEmpty(").contains("checkpoint() ⇢ at reactor.core.publisher.FluxOnAssemblyTest.checkpointEmpty(");
} else {
// the traceback "error has been observed" only contains the checkpoint, with callsite,
// assembly points to filter
assertThat(debugStack).contains("Assembly trace from producer [reactor.core.publisher.FluxFilterFuseable] :").contains("checkpoint() ⇢ at reactor.core.publisher.FluxOnAssemblyTest.checkpointEmpty(").doesNotContain("Flux.filter ⇢ at");
}
}
Aggregations