
entry-point.async-event-handler.queries-handler.test.mustache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scaffold-clean-architecture Show documentation
Show all versions of scaffold-clean-architecture Show documentation
Gradle plugin to create a clean application in Java that already works, It follows our best practices!
package {{package}}.events.handlers;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import reactor.test.StepVerifier;
{{#eda}}
import org.reactivecommons.async.api.AsyncQuery;
import io.cloudevents.CloudEvent;
import io.cloudevents.core.builder.CloudEventBuilder;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.net.URI;
import java.util.UUID;
{{/eda}}
public class QueriesHandlerTest {
QueriesHandler queriesHandler;
@BeforeEach
void setUp() {
queriesHandler = new QueriesHandler();
}
{{#eda}}
@Test
void QueriesHandlerTest() throws JsonProcessingException {
ObjectMapper objectMapper = new ObjectMapper();
CloudEvent query = CloudEventBuilder.v1() //
.withId(UUID.randomUUID().toString()) //
.withSource(URI.create("https://spring.io/foos"))//
.withType("query")
.withData("application/json", objectMapper.writeValueAsBytes("Data"))
.build();
StepVerifier.create(queriesHandler
.handleQueryA(new AsyncQuery(query.getType(), query)))
.expectComplete();
}
{{/eda}}
{{^eda}}
@Test
void QueriesHandlerTest(){
StepVerifier.create(queriesHandler
.handleQueryA("Data"))
.expectComplete();
}
{{/eda}}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy