### Question:
ShortenerHandler implements HttpHandler { Mono<ServerResponse> create(ServerRequest request) { log.info("execute() -> "); return request.bodyToMono(CreateShortener.class) .flatMap(shortenerService::create) .flatMap(this::mapToResponse); } ShortenerHandler(ShortenerService shortenerService, ShortenerQuery shortenerQuery); @Override RouterFunction<ServerResponse> route();  }### Answer:
@Test public void get() { String userId = UUID.randomUUID().toString(); String key = service.create(CreateShortener.builder() .url("www.tes.com") .userId(userId) .build()) .block().key(); webTestClient.get().uri("/shorteners/map/{key}", key).accept(MediaType.APPLICATION_JSON).exchange() .expectStatus() .is3xxRedirection() .expectBody(); }
@Test public void create() { String url = "www.testLong.org"; String userId = UUID.randomUUID().toString(); CreateShortener request = CreateShortener.builder() .url(url) .userId(userId) .build(); ShortenerDto result = webTestClient.post().uri("/shorteners") .contentType(MediaType.APPLICATION_JSON) .body(BodyInserters.fromValue(request)) .exchange() .expectHeader().contentType(MediaType.APPLICATION_JSON) .expectBody(ShortenerDto.class).returnResult().getResponseBody(); assertTrue(result.url().equals(url)); assertFalse(result.key().isEmpty()); assertTrue(!result.id().isEmpty()); }