@Override
  public Optional<HouseTable> findById(HouseTablePrimaryKey houseTablePrimaryKey) {

    return getHtsRetryTemplate(
            Arrays.asList(
                HouseTableRepositoryStateUnkownException.class, IllegalStateException.class))
        .execute(
            context ->
                apiInstance
                    .getUserTable(
                        houseTablePrimaryKey.getDatabaseId(), houseTablePrimaryKey.getTableId())
                    .map(EntityResponseBodyUserTable::getEntity)
                    .map(houseTableMapper::toHouseTable)
                    .switchIfEmpty(Mono.empty())
                    .onErrorResume(this::handleHtsHttpError)
                    .blockOptional(Duration.ofSeconds(REQUEST_TIMEOUT_SECONDS)));
  }
@Test
  public void testFindByIdWithErrors() {
    HashMap<Integer, Class> map = new HashMap<>();
    map.put(404, HouseTableNotFoundException.class);
    map.put(409, HouseTableConcurrentUpdateException.class);
    map.put(400, HouseTableCallerException.class);

    for (HashMap.Entry<Integer, Class> entry : map.entrySet()) {
      mockHtsServer.enqueue(
          new MockResponse()
              .setResponseCode(entry.getKey())
              .setBody("")
              .addHeader("Content-Type", "application/json"));
      Assertions.assertThrowsExactly(
          entry.getValue(),
          () ->
              htsRepo
                  .findById(
                      HouseTablePrimaryKey.builder()
                          .tableId(HOUSE_TABLE.getTableId())
                          .databaseId(HOUSE_TABLE.getDatabaseId())
                          .build())
                  .get(),
          entry.getKey().toString());
    }
  }