@Override
  public void write(String propertyKey, @Nullable String value) {
    checkPropertyKey(propertyKey);

    try (DbSession dbSession = dbClient.openSession(false)) {
      if (value == null || value.isEmpty()) {
        dbClient.internalPropertiesDao().saveAsEmpty(dbSession, propertyKey);
      } else {
        dbClient.internalPropertiesDao().save(dbSession, propertyKey, value);
      }
      dbSession.commit();
    }
  }
@Test
  public void write_calls_dao_saveAsEmpty_when_value_is_null() {
    underTest.write(SOME_KEY, null);

    verify(internalPropertiesDao).saveAsEmpty(dbSession, SOME_KEY);
    verify(dbSession).commit();
  }