vertx/src/test/java/eu/internetofus/common/vertx/NotFoundHandlerTest.java
/**
   * Verify that return a not found error.
   */
Verify that return a not found error.
Verify that return a not found error .
@Test
  public void shouldReturnNotFoundErrorMessage() {
    final var handler = new NotFoundHandler();
    final var event = mock(RoutingContext.class);
    final var response = mock(HttpServerResponse.class);
    doReturn(response).when(event).response();
    handler.handle(event);
    verify(response, times(1)).setStatusCode(404);
    verify(response, times(1)).putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
    verify(response, times(1)).end("{\"code\":\"not_found_api_request_path\",\"message\":\"The 'null' is not defined on the API.\"}");
  }
@ Test public void shouldReturnNotFoundErrorMessage ( ) { final var handler = new NotFoundHandler ( ) ; final var event = mock ( RoutingContext . class ) ; final var response = mock ( HttpServerResponse . class ) ; doReturn ( response ) . when ( event ) . response ( ) ; handler . handle ( event ) ; verify ( response , times ( 1 ) ) . setStatusCode ( 404 ) ; verify ( response , times ( 1 ) ) . putHeader ( HttpHeaders . CONTENT_TYPE , MediaType . APPLICATION_JSON ) ; verify ( response , times ( 1 ) ) . end ( "{\"code\":\"not_found_api_request_path\",\"message\":\"The 'null' is not defined on the API.\"}" ) ; }
Verify that return a not found error.
Verify that return a not found error .