@Override
  public MetricsRepository load() {
    List<Metric> metrics = new ArrayList<>();
    try {
      loadFromPaginatedWs(metrics);
    } catch (Exception e) {
      throw new IllegalStateException("Unable to load metrics", e);
    }
    return new MetricsRepository(metrics);
  }
@Test
  public void testIOError() throws IOException {
    Reader reader = mock(Reader.class);
    when(reader.read(any(char[].class), anyInt(), anyInt())).thenThrow(new IOException());
    WsTestUtil.mockReader(wsClient, reader);
    assertThatThrownBy(() -> metricsRepositoryLoader.load())
      .isInstanceOf(IllegalStateException.class);
  }