SanitizedSecret { @JsonCreator public static SanitizedSecret of( @JsonProperty("id") long id, @JsonProperty("name") String name, @JsonProperty("description") @Nullable String description, @JsonProperty("checksum") String checksum, @JsonProperty("createdAt") ApiDate createdAt, @JsonProperty("createdBy") @Nullable String createdBy, @JsonProperty("updatedAt") ApiDate updatedAt, @JsonProperty("updatedBy") @Nullable String updatedBy, @JsonProperty("metadata") @Nullable Map<String, String> metadata, @JsonProperty("type") @Nullable String type, @JsonProperty("generationOptions") @Nullable Map<String, String> generationOptions, @JsonProperty("expiry") long expiry, @JsonProperty("version") @Nullable Long version, @JsonProperty("contentCreatedAt") @Nullable ApiDate contentCreatedAt, @JsonProperty("contentCreatedBy") @Nullable String contentCreatedBy) { ImmutableMap<String, String> meta = (metadata == null) ? ImmutableMap.of() : ImmutableMap.copyOf(metadata); ImmutableMap<String, String> genOptions = (generationOptions == null) ? ImmutableMap.of() : ImmutableMap.copyOf(generationOptions); return new AutoValue_SanitizedSecret(id, name, nullToEmpty(description), checksum, createdAt, nullToEmpty(createdBy), updatedAt, nullToEmpty(updatedBy), meta, Optional.ofNullable(type), genOptions, expiry, Optional.ofNullable(version), Optional.ofNullable(contentCreatedAt), nullToEmpty(contentCreatedBy)); }  @JsonCreator static SanitizedSecret of(
      @JsonProperty("id") long id,
      @JsonProperty("name") String name,
      @JsonProperty("description") @Nullable String description,
      @JsonProperty("checksum") String checksum,
      @JsonProperty("createdAt") ApiDate createdAt,
      @JsonProperty("createdBy") @Nullable String createdBy,
      @JsonProperty("updatedAt") ApiDate updatedAt,
      @JsonProperty("updatedBy") @Nullable String updatedBy,
      @JsonProperty("metadata") @Nullable Map<String, String> metadata,
      @JsonProperty("type") @Nullable String type,
      @JsonProperty("generationOptions") @Nullable Map<String, String> generationOptions,
      @JsonProperty("expiry") long expiry,
      @JsonProperty("version") @Nullable Long version,
      @JsonProperty("contentCreatedAt") @Nullable ApiDate contentCreatedAt,
      @JsonProperty("contentCreatedBy") @Nullable String contentCreatedBy); static SanitizedSecret of(long id, String name); static SanitizedSecret fromSecretSeriesAndContent(SecretSeriesAndContent seriesAndContent); static SanitizedSecret fromSecret(Secret secret); @JsonProperty abstract long id(); @JsonProperty abstract String name(); @JsonProperty abstract String description(); @JsonProperty abstract String checksum(); @JsonProperty abstract ApiDate createdAt(); @JsonProperty abstract String createdBy(); @JsonProperty abstract ApiDate updatedAt(); @JsonProperty abstract String updatedBy(); @JsonProperty abstract ImmutableMap<String, String> metadata(); @JsonProperty abstract Optional<String> type(); @JsonProperty abstract ImmutableMap<String, String> generationOptions(); @JsonProperty abstract long expiry(); @JsonProperty abstract Optional<Long> version(); @JsonProperty abstract Optional<ApiDate> contentCreatedAt(); @JsonProperty abstract String contentCreatedBy(); static String displayName(SanitizedSecret sanitizedSecret);  }
@Test public void serializesCorrectly() throws Exception { SanitizedSecret sanitizedSecret = SanitizedSecret.of( 767, "trapdoor", "v1", "checksum", ApiDate.parse("2013-03-28T21:42:42.573Z"), "keywhizAdmin", ApiDate.parse("2013-03-28T21:42:42.573Z"), "keywhizAdmin", ImmutableMap.of("owner", "the king"), "password", ImmutableMap.of("favoriteFood", "PB&J sandwich"), 1136214245, 1L, ApiDate.parse("2013-03-28T21:42:42.573Z"), "keywhizAdmin"); assertThat(asJson(sanitizedSecret)) .isEqualTo(jsonFixture("fixtures/sanitizedSecret.json")); }