public PropertyDto setKey(String key) {
    checkArgument(key.length() <= MAX_KEY_LENGTH, "Setting key length (%s) is longer than the maximum authorized (%s). '%s' was provided", key.length(), MAX_KEY_LENGTH, key);
    this.key = key;
    return this;
  }
@Test
  void fail_if_key_longer_than_512_characters() {
    String veryLongKey = Strings.repeat("a", 513);

    assertThatThrownBy(() -> underTest.setKey(veryLongKey))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessage("Setting key length (513) is longer than the maximum authorized (512). '" + veryLongKey + "' was provided");
  }