components/src/test/java/eu/internetofus/common/components/social_context_builder/WeNetSocialContextBuilderSimulatorTest.java
/**
   * Should set and get the social preferences answers.
   *
   * @param vertx       that contains the event bus to use.
   * @param testContext context over the tests.
   */
Should set and get the social preferences answers.
@param vertx       that contains the event bus to use.
@param testContext context over the tests.
Should set and get the social preferences answers . @param vertx that contains the event bus to use . @param testContext context over the tests .
@Test
  public void shouldSetGetSocialPreferencesAnswersForUserOnTask(final Vertx vertx, final VertxTestContext testContext) {
    final var userId = UUID.randomUUID().toString();
    final var taskId = UUID.randomUUID().toString();
    testContext.assertComplete(
        WeNetSocialContextBuilderSimulator.createProxy(vertx).getSocialPreferencesAnswersForUserOnTask(userId, taskId))
        .onSuccess(ranking -> testContext.verify(() -> {
          assertThat(ranking).isNotNull();
          final var preferences = new UserAnswersTest().createModelExample(0);
          testContext
              .assertComplete(WeNetSocialContextBuilderSimulator.createProxy(vertx)
                  .postSocialPreferencesAnswersForUserOnTask(userId, taskId, preferences))
              .onSuccess(storedPreferences -> testContext.verify(() -> {
                assertThat(storedPreferences).isEqualTo(preferences.data);
                testContext
                    .assertComplete(WeNetSocialContextBuilderSimulator.createProxy(vertx)
                        .getSocialPreferencesAnswersForUserOnTask(userId, taskId))
                    .onSuccess(retrievePreferences2 -> testContext.verify(() -> {
                      assertThat(retrievePreferences2).isEqualTo(preferences);
                      testContext.completeNow();
                    }));
              }));
        }));
  }
@ Test public void shouldSetGetSocialPreferencesAnswersForUserOnTask ( final Vertx vertx , final VertxTestContext testContext ) { final var userId = UUID . randomUUID ( ) . toString ( ) ; final var taskId = UUID . randomUUID ( ) . toString ( ) ; testContext . assertComplete ( WeNetSocialContextBuilderSimulator . createProxy ( vertx ) . getSocialPreferencesAnswersForUserOnTask ( userId , taskId ) ) . onSuccess ( ranking -> testContext . verify ( ( ) -> { assertThat ( ranking ) . isNotNull ( ) ; final var preferences = new UserAnswersTest ( ) . createModelExample ( 0 ) ; testContext . assertComplete ( WeNetSocialContextBuilderSimulator . createProxy ( vertx ) . postSocialPreferencesAnswersForUserOnTask ( userId , taskId , preferences ) ) . onSuccess ( storedPreferences -> testContext . verify ( ( ) -> { assertThat ( storedPreferences ) . isEqualTo ( preferences . data ) ; testContext . assertComplete ( WeNetSocialContextBuilderSimulator . createProxy ( vertx ) . getSocialPreferencesAnswersForUserOnTask ( userId , taskId ) ) . onSuccess ( retrievePreferences2 -> testContext . verify ( ( ) -> { assertThat ( retrievePreferences2 ) . isEqualTo ( preferences ) ; testContext . completeNow ( ) ; } ) ) ; } ) ) ; } ) ) ; }
Should set and get the social preferences answers.
Should set and get the social preferences answers .