vertx/src/test/java/eu/internetofus/common/vertx/ServiceRequestsTest.java
/**
   * Check return the default language.
   *
   * @param acceptLanguage header value.
   */
Check return the default language.
@param acceptLanguage header value.
Check return the default language . @param acceptLanguage header value .
@ParameterizedTest(name = "Should return the default value for the Accept-Language= {0}")
  @NullAndEmptySource
  @ValueSource(strings = { "*", "es", "es-US,es;q=0.5" })
  public void shouldAcceptLanguageByTheDefault(final String acceptLanguage) {
    final var headers = new JsonObject();
    if (acceptLanguage != null) {
      headers.put(HttpHeaders.ACCEPT_LANGUAGE, acceptLanguage);
    }
    final var request = new ServiceRequest(new JsonObject().put("headers", headers));
    assertThat(ServiceRequests.acceptedLanguageIn(request, "en", "ca")).isEqualTo("en");
  }
@ ParameterizedTest ( name = "Should return the default value for the Accept-Language= {0}" ) @ NullAndEmptySource @ ValueSource ( strings = { "*" , "es" , "es-US,es;q=0.5" } ) public void shouldAcceptLanguageByTheDefault ( final String acceptLanguage ) { final var headers = new JsonObject ( ) ; if ( acceptLanguage != null ) { headers . put ( HttpHeaders . ACCEPT_LANGUAGE , acceptLanguage ) ; } final var request = new ServiceRequest ( new JsonObject ( ) . put ( "headers" , headers ) ) ; assertThat ( ServiceRequests . acceptedLanguageIn ( request , "en" , "ca" ) ) . isEqualTo ( "en" ) ; }
Check return the default language.
Check return the default language .