GtdDev
GtdDev

Reputation: 928

Testing Spring webflux complain about "Unfinished Step Verifier". Ho finish the test properly and fully?

I am using SpringWebflux to playground some tests.

I am getting one highlight in IDE, saing "Unfinished Step Verifier"

Thats my code:

    @Test
    public void findAllNextMatches() {
        StepVerifier
                .create(repo.findAll())
                .expectNextMatches(u -> u.getId()
                                         .equals(cust1.getId()))
                .expectComplete();
    }

The IntellijIdea Highlight "expectComplete", and complain saying: "Unfinished Step Verifier".

How Can I finish the test properly , in order to avoid, the complaiment above?

Thanks a lot, in advance

Upvotes: 0

Views: 1198

Answers (2)

Felipe
Felipe

Reputation: 7563

I would suggest to use the verifyComplete() instead of the simple verify(), because you can avoid the .expectComplete() since you know that the test must return something.

I use verify() when the test must NOT return any value but I need to execute the Flux.

The docs also suggest

This is a convenience method that calls StepVerifier.verify() in addition to the expectation.

Upvotes: 3

Related Questions