quarkus smallrye reactive messaging - unittest

32 views Asked by At

I'm trying to implement a small unittest, here I have 3 methods:

@ApplicationScoped
public class MyReactiveMessaging {

    @Outgoing("from-producer-to-processor")
    public ClassA produce() {
        return new ClassA("Hello world!");
    }

    @Incoming("from-producer-to-processor")
    @Outgoing("from-processor-to-consumer")
    public ClassB process(ClassA classA) {
        return new ClassB(String.format("%s-ish", classA.value));
    }

    @Incoming("from-processor-to-consumer")
    public void consume(ClassB classB) {
        log.infof("Consumer received %s", classB);
    }
}

The test unit is annotated with @QuarkusTest When I start the test unit, @QuarkusTest starts Quarkus and the method produce() starts to send ClassA objects.

But I want to test only the process() method.

In other words, the test unit works only if I remove the annotation form the methodsĀ  produce() and consume().

Are there any documentation/examples that show how to write unittests with reactive messaging?

I have a small project written to explain how to use reactive messaging. This project it is based on the current online documentation.

https://github.com/freedev/getting-started-with-reactive-messaging/actions/runs/8423438079/job/23065063098d

How can I write my own user test?

0

There are 0 answers