@Test public void getAllTest() { StatisticDocument statisticDocument1 = new StatisticDocument(UUID.randomUUID().toString(), UUID.randomUUID().toString(), Instant.now(), EventType.SHORTENER_VIEWED, UUID.randomUUID().toString()); repository.save(statisticDocument1).subscribe(); StatisticDocument statisticDocument2 = new StatisticDocument(UUID.randomUUID().toString(), UUID .randomUUID().toString(), Instant.now(), EventType.SHORTENER_VIEWED, UUID.randomUUID().toString()); repository.save(statisticDocument2).subscribe(); webTestClient.get().uri("/statistics").accept(MediaType .APPLICATION_JSON).exchange() .expectStatus().isOk() .expectHeader().contentType(MediaType.APPLICATION_JSON) .expectBody(); }
Mono<ServerResponse> getAll(ServerRequest request) { return ok() .contentType(MediaType.APPLICATION_JSON) .body(service.getAll(), StatisticDocument.class); }
StatisticHandler implements HttpHandler { Mono<ServerResponse> getAll(ServerRequest request) { return ok() .contentType(MediaType.APPLICATION_JSON) .body(service.getAll(), StatisticDocument.class); } }
StatisticHandler implements HttpHandler { Mono<ServerResponse> getAll(ServerRequest request) { return ok() .contentType(MediaType.APPLICATION_JSON) .body(service.getAll(), StatisticDocument.class); } StatisticHandler(StatisticService service); }
StatisticHandler implements HttpHandler { Mono<ServerResponse> getAll(ServerRequest request) { return ok() .contentType(MediaType.APPLICATION_JSON) .body(service.getAll(), StatisticDocument.class); } StatisticHandler(StatisticService service); @Override RouterFunction<ServerResponse> route(); }
StatisticHandler implements HttpHandler { Mono<ServerResponse> getAll(ServerRequest request) { return ok() .contentType(MediaType.APPLICATION_JSON) .body(service.getAll(), StatisticDocument.class); } StatisticHandler(StatisticService service); @Override RouterFunction<ServerResponse> route();  }