As a Java-User, I think the awaitAssert () api is not friendly.
Why is the Lambda-Expression a Supplier, or why do I have to return null? Using Consumer makes more sense in my opinion. If there is a use of the supplied value, its purpose should be noted in the docs.
example of akka 2.5.7:
new TestKit(system) {{
getRef().tell(42, ActorRef.noSender());
awaitAssert(() -> {
assertEquals(msgAvailable(), true);
return null;
});
}};
The docs don't mention what to do about the return value.
The reason is that awaitAssert actually returns the successful value from the Supplier when it does not fail. This is really useful in some contexts and works fine in the Scala API as returning nothing there is less noisy.
Consumer wouldn't make sense though as there is no value going into the block, akka.japi.function.Effect would be a better match for that.
Not so nice with Java I agree, but not quite sure what to do about it, we can't change the signature of the method, that'd likely break a lot of test code and trying to get a value out of the closure is messy. We can't add an overload as that will cause ambiguity for the Java compiler. The only viable option is to come up with a separate name that is similar but expresses the I-dont-want-to-return-anything-aspect. Can't say I can think of anything from the top of my head though.
You have any ideas?
The docs don't mention what to do about the return value.
I think we should at least do that. Triaged
Being worked on hackathon
Most helpful comment
Being worked on hackathon