Comparing Gateway Routes without false negatives

I have an app and want to write some tests. Since it’s a reactive app, a Spring-powered Gateway, I almost certainly need to use StepVerifier. My code may include something like this:

StepVerifier.create(routeLocator.getRoutes())
            .expectNext(expectedRoute)
            .expectComplete()
            .verify();

The thing is expectNext() in turn invokes equals() of Route

// Route's equals()

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		Route route = (Route) o;
		return this.order == route.order && Objects.equals(this.id, route.id) && Objects.equals(this.uri, route.uri)
				&& Objects.equals(this.predicate, route.predicate)
				&& Objects.equals(this.gatewayFilters, route.gatewayFilters)
				&& Objects.equals(this.metadata, route.metadata);
	}

which in turn invokes equals() of AsyncPredicate (the type of Route’s predicate field) which it doesn’t override and inherits from Object (GitHub issue). As a result, this test wouldn’t pass due to a false negative:

class RouteEqualityTest {

    @Test
    void testTwoIdenticalRouteAreEqual() {
        assertThat(getRouteBuilderStub().build()).isEqualTo(getRouteBuilderStub().build());
    }

    private Route.AsyncBuilder getRouteBuilderStub() {
        return Route.async()
                .id("123")
                .uri("https://example.com")
                .predicate(exchange -> exchange.getRequest()
                        .getPath()
                        .value()
                        .equals("/test-path"));
    }
}

How can (should) I resolve this conundrum?

What exactly are you trying to test?

If it’s the end-result of an async call. You need to make make sure the async calls resolve before comparing them, otherwise there’s no point.
Try saving the result into temp variables and assert that those two are the same (once resolved).