Polishing.

Replace usage of StepVerifier.create with StepVerifier::create.

Original pull request: #672
See #671
This commit is contained in:
Christoph Strobl
2023-11-02 10:05:18 +01:00
committed by Mark Paluch
parent f98c7b9c93
commit e66d317d47
8 changed files with 58 additions and 26 deletions

View File

@@ -77,7 +77,7 @@ class KeyCommandsTests {
.count() //
.doOnSuccess(count -> System.out.println(String.format("Total No. found: %s", count)));
StepVerifier.create(keyCount).expectNext(50L).verifyComplete();
keyCount.as(StepVerifier::create).expectNext(50L).verifyComplete();
}
/**
@@ -98,7 +98,7 @@ class KeyCommandsTests {
.flatMap(result -> llen) //
.doOnNext(count -> System.out.println(String.format("Total items in list left: %s", count)));//
StepVerifier.create(popAndLlen).expectNext(0L).verifyComplete();
popAndLlen.as(StepVerifier::create).expectNext(0L).verifyComplete();
}
private void generateRandomKeys(int nrKeys) {
@@ -109,7 +109,9 @@ class KeyCommandsTests {
.map(key -> SetCommand.set(key) //
.value(ByteBuffer.wrap(UUID.randomUUID().toString().getBytes())));
StepVerifier.create(connection.stringCommands().set(generator)).expectNextCount(nrKeys).verifyComplete();
connection.stringCommands().set(generator).as(StepVerifier::create) //
.expectNextCount(nrKeys) //
.verifyComplete();
}

View File

@@ -56,7 +56,7 @@ class JacksonJsonTests {
@Test
void shouldWriteAndReadPerson() {
StepVerifier.create(typedOperations.opsForValue().set("homer", new Person("Homer", "Simpson"))) //
typedOperations.opsForValue().set("homer", new Person("Homer", "Simpson")).as(StepVerifier::create) //
.expectNext(true) //
.verifyComplete();

View File

@@ -45,7 +45,10 @@ class ListOperationsTests {
@BeforeEach
void before() {
StepVerifier.create(operations.execute(it -> it.serverCommands().flushDb())).expectNext("OK").verifyComplete();
operations.execute(it -> it.serverCommands().flushDb()).as(StepVerifier::create) //
.expectNext("OK") //
.verifyComplete();
}
/**
@@ -63,7 +66,7 @@ class ListOperationsTests {
.log("example.springdata.redis", Level.INFO);
log.info("Blocking pop...waiting for message");
StepVerifier.create(blpop) //
blpop.as(StepVerifier::create) //
.then(() -> {
Mono.delay(Duration.ofSeconds(10)).doOnSuccess(it -> {

View File

@@ -46,7 +46,10 @@ class ValueOperationsTests {
@BeforeEach
void before() {
StepVerifier.create(operations.execute(it -> it.serverCommands().flushDb())).expectNext("OK").verifyComplete();
operations.execute(it -> it.serverCommands().flushDb()).as(StepVerifier::create) //
.expectNext("OK") //
.verifyComplete();
}
/**
@@ -67,14 +70,14 @@ class ValueOperationsTests {
log.info("Initial access (takes a while...)");
StepVerifier.create(cachedMono).expectSubscription() //
cachedMono.as(StepVerifier::create).expectSubscription() //
.expectNoEvent(Duration.ofSeconds(9)) //
.expectNext("Hello, World!") //
.verifyComplete();
log.info("Subsequent access (use cached value)");
var duration = StepVerifier.create(cachedMono) //
var duration = cachedMono.as(StepVerifier::create) //
.expectNext("Hello, World!") //
.verifyComplete();