components/src/test/java/eu/internetofus/common/components/service/WeNetServiceSimulatorTest.java
/**
   * Should create, retrieve and delete a app.
   *
   * @param vertx       that contains the event bus to use.
   * @param testContext context over the tests.
   */
Should create, retrieve and delete a app.
@param vertx       that contains the event bus to use.
@param testContext context over the tests.
Should create retrieve and delete a app . @param vertx that contains the event bus to use . @param testContext context over the tests .
@Test
  public void shouldCreateRetrieveAndDeleteApp(final Vertx vertx, final VertxTestContext testContext) {
    testContext.assertComplete(WeNetServiceSimulator.createProxy(vertx).createApp(new App())).onSuccess(create -> {
      final var id = create.appId;
      testContext.assertComplete(WeNetServiceSimulator.createProxy(vertx).retrieveApp(id))
          .onSuccess(retrieve -> testContext.verify(() -> {
            assertThat(create).isEqualTo(retrieve);
            testContext.assertComplete(WeNetServiceSimulator.createProxy(vertx).deleteApp(id)).onSuccess(empty -> {
              testContext.assertFailure(WeNetServiceSimulator.createProxy(vertx).retrieveApp(id))
                  .onFailure(error -> testContext.verify(() -> {
                    assertThat(error).isInstanceOf(ServiceException.class);
                    assertThat(((ServiceException) error).failureCode()).isEqualTo(Status.NOT_FOUND.getStatusCode());
                    testContext.completeNow();
                  }));
            });
          }));
    });
  }
@ Test public void shouldCreateRetrieveAndDeleteApp ( final Vertx vertx , final VertxTestContext testContext ) { testContext . assertComplete ( WeNetServiceSimulator . createProxy ( vertx ) . createApp ( new App ( ) ) ) . onSuccess ( create -> { final var id = create . appId ; testContext . assertComplete ( WeNetServiceSimulator . createProxy ( vertx ) . retrieveApp ( id ) ) . onSuccess ( retrieve -> testContext . verify ( ( ) -> { assertThat ( create ) . isEqualTo ( retrieve ) ; testContext . assertComplete ( WeNetServiceSimulator . createProxy ( vertx ) . deleteApp ( id ) ) . onSuccess ( empty -> { testContext . assertFailure ( WeNetServiceSimulator . createProxy ( vertx ) . retrieveApp ( id ) ) . onFailure ( error -> testContext . verify ( ( ) -> { assertThat ( error ) . isInstanceOf ( ServiceException . class ) ; assertThat ( ( ( ServiceException ) error ) . failureCode ( ) ) . isEqualTo ( Status . NOT_FOUND . getStatusCode ( ) ) ; testContext . completeNow ( ) ; } ) ) ; } ) ; } ) ) ; } ) ; }
Should create, retrieve and delete a app.
Should create retrieve and delete a app .