Differences

This shows you the differences between two versions of the page.

Link to this comparison view

irc:1431727200 [2017/05/27 13:44] (current)
Line 1: Line 1:
 +
 +
 +[17:32:38] <spriet2000> hi! is there a way to mock a HttpServerRequest to let the bodyhandler handle a custom buffer?
 +
 +[17:32:56] <spriet2000> HttpServerRequest request = mock(HttpServerRequest.class);
 +
 +[17:34:35] <spriet2000> (i want to simulate a post request without making a post using the httpclient)
 +
 +[17:43:01] <spriet2000> i think its impossible to feed the bodyHandler a buffer stream currently..
 +
 +[17:45:01] <spriet2000> but it could be helpfull to test parsing bodies..
 +
 +[17:45:15] <AlexLehm> i have not done much with mocks in vert.x, but it should be possible to use something like mockito
 +
 +[17:45:38] <spriet2000> yes i currently use it and it works for simple stuff
 +
 +[17:46:23] <spriet2000> but feeding the bodyhandler a buffer is impossible i think? is the idea bad?
 +
 +[17:47:18] <spriet2000> i can setup client server with request.. but i always have trouble setting it up .. countdown latches etc..
 +
 +[17:47:37] <AlexLehm> are you using vert.x 2 or 3
 +
 +[17:47:40] <spriet2000> 3
 +
 +[17:48:03] <AlexLehm> if you are using vert.x 3 you might want to check out vertx-unit, that handles the concurrency quite nicely
 +
 +[17:49:30] <spriet2000> apex is using client server construction https://github.com/vert-x3/vertx-apex/blob/master/src/test/java/io/vertx/ext/apex/ApexTestBase.java
 +
 +[17:49:44] <spriet2000> i guess its impossible than or stupid idead
 +
 +[18:00:38] <spriet2000> well.. i can implement a custom httpserverrequest and add somthing to trigger the bodyhandler
 +
 +[18:00:40] <spriet2000> :>
 +
 +[18:46:37] <AlexLehm> if HttServerRequest is an interface you should be able to implement that, but you have to inject your class somehow
 +
 +[20:24:01] <spriet2000> yeps