AutomationSecretResponse { public static AutomationSecretResponse create(long id, String name, String secret, ApiDate creationDate, ImmutableMap<String, String> metadata, ImmutableList<Group> groups, long expiry) { return new AutoValue_AutomationSecretResponse(id, name, secret, decodedLength(secret), creationDate, groups, metadata, expiry); }  static AutomationSecretResponse create(long id, String name, String secret,
      ApiDate creationDate,
      ImmutableMap<String, String> metadata, ImmutableList<Group> groups, long expiry); static AutomationSecretResponse fromSecret(Secret secret, ImmutableList<Group> groups); @JsonProperty("id") abstract long id(); @JsonProperty("name") abstract String name(); @JsonProperty("secret") abstract String secret(); @JsonProperty("secretLength") abstract long secretLength(); @JsonProperty("creationDate") abstract ApiDate creationDate(); @JsonProperty("groups") abstract ImmutableList<Group> groups(); @JsonAnyGetter @JsonProperty("metadata") abstract Map<String, String> metadata(); @JsonProperty("expiry") abstract long expiry();  }
@Test public void serializesCorrectly() throws Exception { String secret = "YXNkZGFz"; AutomationSecretResponse automationSecretResponse = AutomationSecretResponse.create( 0, "Database_Password", secret, ApiDate.parse("2011-09-29T15:46:00.000Z"), ImmutableMap.of(), ImmutableList.of(), 1136214245); assertThat(asJson(automationSecretResponse)) .isEqualTo(jsonFixture("fixtures/automationSecretResponse.json")); AutomationSecretResponse automationSecretResponseWithMetadata = AutomationSecretResponse.create( 66, "Nobody_PgPass", secret, ApiDate.parse("2011-09-29T15:46:00.000Z"), ImmutableMap.of("mode", "0400", "owner", "nobody"), ImmutableList.of(), 1136214245); assertThat(asJson(automationSecretResponseWithMetadata)) .isEqualTo(jsonFixture("fixtures/automationSecretResponseWithMetadata.json")); }