@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
      value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
      justification = "Handled in switchIfEmpty")
  @Override
  public HouseTable save(HouseTable entity) {
    CreateUpdateEntityRequestBodyUserTable requestBody =
        new CreateUpdateEntityRequestBodyUserTable().entity(houseTableMapper.toUserTable(entity));

    return getHtsRetryTemplate(Arrays.asList(IllegalStateException.class))
        .execute(
            context ->
                apiInstance
                    .putUserTable(requestBody)
                    .map(EntityResponseBodyUserTable::getEntity)
                    .map(houseTableMapper::toHouseTable)
                    .onErrorResume(this::handleHtsHttpError)
                    .block(Duration.ofSeconds(REQUEST_TIMEOUT_SECONDS)));
  }
@Test
  public void testRepoSaveWithClientError() {
    mockHtsServer.enqueue(
        new MockResponse()
            .setResponseCode(409)
            .setBody("RESPONSE BODY DOESNT MATTER")
            .addHeader("Content-Type", "application/json"));
    Assertions.assertThrowsExactly(
        HouseTableConcurrentUpdateException.class, () -> htsRepo.save(HOUSE_TABLE), "409");

    mockHtsServer.enqueue(
        new MockResponse()
            .setResponseCode(404)
            .setBody("RESPONSE BODY DOESNT MATTER")
            .addHeader("Content-Type", "application/json"));
    Assertions.assertThrowsExactly(
        HouseTableNotFoundException.class, () -> htsRepo.save(HOUSE_TABLE), "404");

    mockHtsServer.enqueue(
        new MockResponse()
            .setResponseCode(400)
            .setBody("RESPONSE BODY DOESNT MATTER")
            .addHeader("Content-Type", "application/json"));
    Assertions.assertThrowsExactly(
        HouseTableCallerException.class, () -> htsRepo.save(HOUSE_TABLE), "400");

    mockHtsServer.enqueue(
        new MockResponse()
            .setResponseCode(401)
            .setBody("RESPONSE BODY DOESNT MATTER")
            .addHeader("Content-Type", "application/json"));
    Assertions.assertThrowsExactly(
        HouseTableCallerException.class, () -> htsRepo.save(HOUSE_TABLE), "401");

    mockHtsServer.enqueue(
        new MockResponse()
            .setResponseCode(429)
            .setBody("RESPONSE BODY DOESNT MATTER")
            .addHeader("Content-Type", "application/json"));
    Assertions.assertThrowsExactly(
        HouseTableCallerException.class, () -> htsRepo.save(HOUSE_TABLE), "429");

    mockHtsServer.enqueue(
        new MockResponse()
            .setResponseCode(403)
            .setBody("RESPONSE BODY DOESNT MATTER")
            .addHeader("Content-Type", "application/json"));
    Assertions.assertThrowsExactly(
        HouseTableCallerException.class, () -> htsRepo.save(HOUSE_TABLE), "403");
  }