@Test public void testWithListOfJsonObject() { AtomicReference<List<JsonObject>> result = new AtomicReference<>(); Service service = Service.createProxy(consumerNode.get(), "my.service"); TestDataObject data = new TestDataObject().setBool(true).setNumber(25).setString("vert.x"); TestDataObject data2 = new TestDataObject().setBool(true).setNumber(26).setString("vert.x"); service.methodWithListOfJsonObject( Arrays.asList(data.toJson(), data2.toJson()), ar -> { if (ar.failed()) { ar.cause().printStackTrace(); } result.set(ar.result()); }); Awaitility.await().atMost(10, TimeUnit.SECONDS).until(() -> result.get() != null); List<JsonObject> out = result.get(); TestDataObject out0 = new TestDataObject(out.get(0)); TestDataObject out1 = new TestDataObject(out.get(1)); assertThat(out0.getNumber()).isEqualTo(25); assertThat(out0.isBool()).isTrue(); assertThat(out0.getString()).isEqualTo("vert.x"); assertThat(out1.getNumber()).isEqualTo(26); assertThat(out1.isBool()).isTrue(); assertThat(out1.getString()).isEqualTo("vert.x"); }
@Test public void testWithJsonObject() { AtomicReference<TestDataObject> result = new AtomicReference<>(); Service service = Service.createProxy(consumerNode.get(), "my.service"); TestDataObject data = new TestDataObject().setBool(true).setNumber(25).setString("vert.x"); service.methodWithJsonObject( data.toJson(), ar -> { result.set(new TestDataObject(ar.result())); }); Awaitility.await().atMost(10, TimeUnit.SECONDS).until(() -> result.get() != null); TestDataObject out = result.get(); assertThat(out.getNumber()).isEqualTo(25); assertThat(out.isBool()).isTrue(); assertThat(out.getString()).isEqualTo("vert.x"); }