model/src/test/java/eu/internetofus/common/model/ValidateContextTest.java
/**
   * Check that a string list value is not valid.
   *
   * @param testContext test context to use.
   *
   * @see ValidateContext#validateNullableStringListField(String, java.util.List,
   *      Promise)
   */
Check that a string list value is not valid.
@param testContext test context to use.


Check that a string list value is not valid . @param testContext test context to use .
@Test
  public void shouldFailValidateNullableStringListField(final VertxTestContext testContext) {
    final Promise<Void> promise = Promise.promise();
    doReturn("codePrefixList").when(this.context).errorCode();
    final var value = Arrays.asList("key1   ", null, "   key2", "", "key2", "        ");
    assertThat(this.context.validateNullableStringListField("list", value, promise)).isSameAs(value);
    testContext.assertFailure(promise.future()).onFailure(error -> {
      testContext.verify(() -> {
        assertThat(error).isInstanceOf(ValidationErrorException.class);
        final var cause = (ValidationErrorException) error;
        assertThat(cause.getCode()).isEqualTo("codePrefixList.list[4]");
        assertThat(cause.getMessage()).contains("key2", "1");
      });
      testContext.completeNow();
    });
  }
@ Test public void shouldFailValidateNullableStringListField ( final VertxTestContext testContext ) { final Promise < Void > promise = Promise . promise ( ) ; doReturn ( "codePrefixList" ) . when ( this . context ) . errorCode ( ) ; final var value = Arrays . asList ( "key1   " , null , "   key2" , "" , "key2" , "        " ) ; assertThat ( this . context . validateNullableStringListField ( "list" , value , promise ) ) . isSameAs ( value ) ; testContext . assertFailure ( promise . future ( ) ) . onFailure ( error -> { testContext . verify ( ( ) -> { assertThat ( error ) . isInstanceOf ( ValidationErrorException . class ) ; final var cause = ( ValidationErrorException ) error ; assertThat ( cause . getCode ( ) ) . isEqualTo ( "codePrefixList.list[4]" ) ; assertThat ( cause . getMessage ( ) ) . contains ( "key2" , "1" ) ; } ) ; testContext . completeNow ( ) ; } ) ; }
Check that a string list value is not valid.
Check that a string list value is not valid .