When testing for non-reciept, I think depending on the scenario its reasonable to use receiveNoWait, or receive(tiny timeout), or some entirely out-of-band check such as management calls to e.g verify no messages remain on the queue etc.
I'd agree that nothing should really ever be doing anything like receive(2000) type calls to verify non-arrival though, except when theres basically a bug in the test logic eg like your note of a loop using the same check to verify delivery and then non-delivery of messages. Robbie On Wed, 11 Sep 2019 at 14:40, Clebert Suconic <[email protected]> wrote: > > I would like to request everybody to not do the following pattern on > tests. That means also look for this pattern on other people's pull > request (including mine.. I'm writing to myself also here). > > > Assert.assertNull(consumer.receive(ANY-TIMEOUT)); > > > Instead, please use consumer.receiveNoWait(); > > > some tests taking 2 seconds on a loop for each time the method is > called, being executed several time can amount for a few extra minutes > on the testsuite. > > > Even though I have seen this pattern in Artemis, this same request is > valid for ActiveMQ. > > > Thank you! > > > -- > Clebert Suconic
