components/src/test/java/eu/internetofus/common/components/service/WeNetServiceSimulatorTest.java
/**
   * Should create, retrieve and delete a app users.
   *
   * @param vertx       that contains the event bus to use.
   * @param testContext context over the tests.
   */
Should create, retrieve and delete a app users.
@param vertx       that contains the event bus to use.
@param testContext context over the tests.
Should create retrieve and delete a app users . @param vertx that contains the event bus to use . @param testContext context over the tests .
@Test
  public void shouldCreateRetrieveAndDeleteAppUsers(final Vertx vertx, final VertxTestContext testContext) {
    final var service = WeNetServiceSimulator.createProxy(vertx);
    testContext.assertComplete(service.createApp(new App())).onSuccess(created -> {
      final var users = new JsonArray().add("1").add("43").add("23");
      testContext.assertComplete(service.addUsers(created.appId, users)).onSuccess(create -> {
        testContext.assertComplete(service.retrieveAppUserIds(created.appId))
            .onSuccess(retrieve -> testContext.verify(() -> {
              assertThat(retrieve).isEqualTo(users);
              testContext.assertComplete(service.deleteUsers(created.appId)).onSuccess(empty -> {
                testContext.assertComplete(service.retrieveAppUserIds(created.appId))
                    .onSuccess(retrieve2 -> testContext.verify(() -> {
                      assertThat(retrieve2).isEqualTo(new JsonArray());
                      testContext.assertComplete(service.deleteApp(created.appId))
                          .onSuccess(emptyApp -> testContext.completeNow());
                    }));
              });
            }));
      });
    });
  }
@ Test public void shouldCreateRetrieveAndDeleteAppUsers ( final Vertx vertx , final VertxTestContext testContext ) { final var service = WeNetServiceSimulator . createProxy ( vertx ) ; testContext . assertComplete ( service . createApp ( new App ( ) ) ) . onSuccess ( created -> { final var users = new JsonArray ( ) . add ( "1" ) . add ( "43" ) . add ( "23" ) ; testContext . assertComplete ( service . addUsers ( created . appId , users ) ) . onSuccess ( create -> { testContext . assertComplete ( service . retrieveAppUserIds ( created . appId ) ) . onSuccess ( retrieve -> testContext . verify ( ( ) -> { assertThat ( retrieve ) . isEqualTo ( users ) ; testContext . assertComplete ( service . deleteUsers ( created . appId ) ) . onSuccess ( empty -> { testContext . assertComplete ( service . retrieveAppUserIds ( created . appId ) ) . onSuccess ( retrieve2 -> testContext . verify ( ( ) -> { assertThat ( retrieve2 ) . isEqualTo ( new JsonArray ( ) ) ; testContext . assertComplete ( service . deleteApp ( created . appId ) ) . onSuccess ( emptyApp -> testContext . completeNow ( ) ) ; } ) ) ; } ) ; } ) ) ; } ) ; } ) ; }
Should create, retrieve and delete a app users.
Should create retrieve and delete a app users .