components/src/test/java/eu/internetofus/common/components/interaction_protocol_engine/WeNetInteractionProtocolEngineTestCase.java
/**
   * Should merge task user state.
   *
   * @param vertx       that contains the event bus to use.
   * @param testContext context over the tests.
   */
Should merge task user state.
@param vertx       that contains the event bus to use.
@param testContext context over the tests.
Should merge task user state . @param vertx that contains the event bus to use . @param testContext context over the tests .
@Test
  public void shouldMergeTaskUserState(final Vertx vertx, final VertxTestContext testContext) {
    StoreServices.storeTaskExample(1, vertx, testContext).onSuccess(task -> {
      final var state = new StateTest().createModelExample(2);
      state.taskId = task.id;
      state.communityId = null;
      state.userId = task.requesterId;
      testContext.assertComplete(this.createComponentProxy(vertx).mergeTaskUserState(state.taskId, state.userId, state))
          .onSuccess(done -> testContext.verify(() -> {
            state._creationTs = done._creationTs;
            state._lastUpdateTs = done._lastUpdateTs;
            assertThat(done).isEqualTo(state);
            state.attributes.put("newKey", "testContext");
            testContext
                .assertComplete(this.createComponentProxy(vertx).mergeTaskUserState(state.taskId, state.userId, state))
                .onSuccess(done2 -> testContext.verify(() -> {
                  state._lastUpdateTs = done2._lastUpdateTs;
                  assertThat(done2).isEqualTo(state);
                  testContext.completeNow();
                }));
          }));
    });
  }
@ Test public void shouldMergeTaskUserState ( final Vertx vertx , final VertxTestContext testContext ) { StoreServices . storeTaskExample ( 1 , vertx , testContext ) . onSuccess ( task -> { final var state = new StateTest ( ) . createModelExample ( 2 ) ; state . taskId = task . id ; state . communityId = null ; state . userId = task . requesterId ; testContext . assertComplete ( this . createComponentProxy ( vertx ) . mergeTaskUserState ( state . taskId , state . userId , state ) ) . onSuccess ( done -> testContext . verify ( ( ) -> { state . _creationTs = done . _creationTs ; state . _lastUpdateTs = done . _lastUpdateTs ; assertThat ( done ) . isEqualTo ( state ) ; state . attributes . put ( "newKey" , "testContext" ) ; testContext . assertComplete ( this . createComponentProxy ( vertx ) . mergeTaskUserState ( state . taskId , state . userId , state ) ) . onSuccess ( done2 -> testContext . verify ( ( ) -> { state . _lastUpdateTs = done2 . _lastUpdateTs ; assertThat ( done2 ) . isEqualTo ( state ) ; testContext . completeNow ( ) ; } ) ) ; } ) ) ; } ) ; }
Should merge task user state.
Should merge task user state .