public Optional<String> retrieve(final String shortCode) throws IOException {
    final URI uri = shortenerHost.resolve(shortCode);
    final HttpRequest request = HttpRequest.newBuilder().uri(uri).GET().build();

    try {
      final HttpResponse<String> response = this.client.send(request, HttpResponse.BodyHandlers.ofString());
      Metrics.counter(EXPAND_COUNTER_NAME, "responseCode", Integer.toString(response.statusCode())).increment();
      return switch (response.statusCode()) {
        case HttpStatus.SC_OK -> Optional.of(response.body());
        case HttpStatus.SC_NOT_FOUND -> Optional.empty();
        default -> throw new IOException("Failed to look up shortcode");
      };
    } catch (InterruptedException e) {
      throw new IOException(e);
    }
  }
@Test
  public void testUriResolution() throws IOException, InterruptedException {
    final HttpClient httpClient = mock(HttpClient.class);
    final ShortCodeExpander expander = new ShortCodeExpander(httpClient, "https://www.example.org/shortener/");
    when(httpClient
        .send(argThat(req -> req.uri().toString().equals("https://www.example.org/shortener/shorturl")), any()))
        .thenReturn(new FakeResponse(200, "longurl"));
    assertThat(expander.retrieve("shorturl").get()).isEqualTo("longurl");
  }