eclipse / microprofile-reactive-streams-operators

Microprofile project
Apache License 2.0
79 stars 33 forks source link

SubscriberBuilderVerification implicitly expects all SubscriberBuilder.build to return an instance of CompletionSubscriber.of #141

Closed akarnokd closed 4 years ago

akarnokd commented 4 years ago

CompletionSubscriber is a Subscriber and offers a getCompletion method. It is expected to be returned from SubscriberBuilder.build. In addition, CompletionSubscriber has an of method to create an instance of it via composing it. The documentation also states

The best way to instantiate one of these is using the {@link CompletionSubscriber#of} factory method.

However, the SubscriberBuilderVerification.build() test expects the SubscriberBuilder.build() method to return an DefaultCompletionSubscriber effectively, not any arbitrary custom implementation of a CompletionSubscriber. The reason for this is that there is an equals assertion and there is no way to get to the DefaultCompletionSubscriber's wrapped Subscriber from the outside.

Essentially, in order to pass the TCK, implementors have to use CompletionSubscriber.of which makes having it as an interface pointless.