Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

How to create io.vertx.mutiny.redis.client.Response in tests

$
0
0

I am trying to mock out the ReactiveRedisClient redisClientThe signature for the get method is io.smallrye.mutiny.Uni<io.vertx.mutiny.redis.client.Response> get(java.lang.String arg0);

However, it doesn't seem like there is any easy way to create an io.vertx.mutiny.redis.client.Response directly.

I ended up with mocking it and creating this solution, but if possible, I'd like to create the Response directly and not have to mock it.

Event event = new Event();        String eventStr = event.toString();        Response response = mock(Response.class);        when(response.toString()).thenReturn(eventStr);        when(redisClient.get(any())).thenReturn(Uni.createFrom().item(response));

Would it be possible to do the above code without mocking the Response

Docs:https://javadoc.io/static/io.quarkus/quarkus-redis-client/1.10.1.Final/io/quarkus/redis/client/reactive/ReactiveRedisClient.htmlhttps://smallrye.io/smallrye-mutiny-vertx-bindings/2.8.0/apidocs/io/vertx/mutiny/redis/client/Response.htmlhttps://vertx.io/docs/apidocs/io/vertx/redis/client/Response.html


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>