Topic { @JsonIgnore public boolean isReplicationConfirmRequired() { return getAck() == Ack.ALL; } Topic(TopicName name, String description, OwnerId owner, RetentionTime retentionTime,
                 boolean migratedFromJsonType, Ack ack, boolean trackingEnabled, ContentType contentType, boolean jsonToAvroDryRunEnabled,
                 @JacksonInject(value = DEFAULT_SCHEMA_ID_SERIALIZATION_ENABLED_KEY, useInput = OptBoolean.TRUE) Boolean schemaIdAwareSerializationEnabled,
                 int maxMessageSize, PublishingAuth publishingAuth, boolean subscribingRestricted,
                 TopicDataOfflineStorage offlineStorage, Instant createdAt, Instant modifiedAt); @JsonCreator  Topic(
            @JsonProperty("name") String qualifiedName,
            @JsonProperty("description") String description,
            @JsonProperty("owner") OwnerId owner,
            @JsonProperty("retentionTime") RetentionTime retentionTime,
            @JsonProperty("jsonToAvroDryRun") boolean jsonToAvroDryRunEnabled,
            @JsonProperty("ack") Ack ack,
            @JsonProperty("trackingEnabled") boolean trackingEnabled,
            @JsonProperty("migratedFromJsonType") boolean migratedFromJsonType,
            @JsonProperty("schemaIdAwareSerializationEnabled") @JacksonInject(value = DEFAULT_SCHEMA_ID_SERIALIZATION_ENABLED_KEY, useInput = OptBoolean.TRUE) Boolean schemaIdAwareSerializationEnabled,
            @JsonProperty("contentType") ContentType contentType,
            @JsonProperty("maxMessageSize") Integer maxMessageSize,
            @JsonProperty("auth") PublishingAuth publishingAuth,
            @JsonProperty("subscribingRestricted") boolean subscribingRestricted,
            @JsonProperty("offlineStorage") TopicDataOfflineStorage offlineStorage,
            @JsonProperty("createdAt") Instant createdAt,
            @JsonProperty("modifiedAt") Instant modifiedAt
    ); RetentionTime getRetentionTime(); @Override int hashCode(); @Override boolean equals(Object obj); @JsonProperty("name") String getQualifiedName(); @JsonIgnore TopicName getName(); String getDescription(); OwnerId getOwner(); @JsonProperty("jsonToAvroDryRun") boolean isJsonToAvroDryRunEnabled(); Ack getAck(); ContentType getContentType(); boolean isTrackingEnabled(); @JsonProperty("migratedFromJsonType") boolean wasMigratedFromJsonType(); @JsonIgnore boolean isReplicationConfirmRequired(); boolean isSchemaIdAwareSerializationEnabled(); int getMaxMessageSize(); @JsonProperty("auth") PublishingAuth getPublishingAuth(); @JsonIgnore boolean isAuthEnabled(); @JsonIgnore boolean isUnauthenticatedAccessEnabled(); boolean hasPermission(String publisher); boolean isSubscribingRestricted(); TopicDataOfflineStorage getOfflineStorage(); Instant getCreatedAt(); void setCreatedAt(Long createdAt); Instant getModifiedAt(); void setModifiedAt(Long modifiedAt); @Override String toString(); static final int MIN_MESSAGE_SIZE; static final int MAX_MESSAGE_SIZE; static final String DEFAULT_SCHEMA_ID_SERIALIZATION_ENABLED_KEY; }
@Test public void shouldSetDefaultAckIfNotPresentInJson() throws Exception { String json = "{\"name\":\"foo.bar\", \"description\": \"description\"}"; Topic topic = objectMapper.readValue(json, Topic.class); assertThat(topic.isReplicationConfirmRequired()).isEqualTo(false); }