@Override
  public List<HouseTable> findAllByDatabaseId(String databaseId) {
    Map<String, String> params = new HashMap<>();
    if (Strings.isNotEmpty(databaseId)) {
      params.put("databaseId", databaseId);
    }

    return getHtsRetryTemplate(
            Arrays.asList(
                HouseTableRepositoryStateUnkownException.class, IllegalStateException.class))
        .execute(
            context ->
                apiInstance
                    .getUserTables(params)
                    .map(GetAllEntityResponseBodyUserTable::getResults)
                    .flatMapMany(Flux::fromIterable)
                    .map(houseTableMapper::toHouseTable)
                    .collectList()
                    .block(Duration.ofSeconds(REQUEST_TIMEOUT_SECONDS)));
  }
@Test
  public void testListOfTablesInDatabase() {
    List<UserTable> tables = new ArrayList<>();
    tables.add(houseTableMapper.toUserTable(HOUSE_TABLE));
    tables.add(houseTableMapper.toUserTable(HOUSE_TABLE_SAME_DB));
    GetAllEntityResponseBodyUserTable listResponse = new GetAllEntityResponseBodyUserTable();

    /**
     * Need to use the reflection trick to help initializing the object with generated class {@link
     * GetAllUserTablesResponseBody}, which somehow doesn't provided proper setter in the generated
     * code.
     */
    Field resultField =
        ReflectionUtils.findField(GetAllEntityResponseBodyUserTable.class, "results");
    Assertions.assertNotNull(resultField);
    ReflectionUtils.makeAccessible(resultField);
    ReflectionUtils.setField(resultField, listResponse, tables);

    mockHtsServer.enqueue(
        new MockResponse()
            .setResponseCode(200)
            .setBody((new Gson()).toJson(listResponse))
            .addHeader("Content-Type", "application/json"));
    List<HouseTable> returnList = htsRepo.findAllByDatabaseId(HOUSE_TABLE.getDatabaseId());
    assertThat(returnList).hasSize(2);
  }