Source:
void createSubscription() { final String topicName = "topic?"; final String subscriptionName = "subscription"; final CreateSubscriptionOptions expected = new CreateSubscriptionOptions(topicName, subscriptionName) .setAutoDeleteOnIdle(Duration.ofSeconds(15)) .setDefaultMessageTimeToLive(Duration.ofSeconds(50)) .setDeadLetteringOnMessageExpiration(true) .setEnableDeadLetteringOnFilterEvaluationExceptions(true) .setEnableBatchedOperations(false) .setForwardTo("Forward-To-This-Queue") .setForwardDeadLetteredMessagesTo("Dead-Lettered-Forward-To") .setLockDuration(Duration.ofSeconds(120)) .setMaxDeliveryCount(15) .setRequiresSession(true) .setStatus(EntityStatus.RECEIVE_DISABLED) .setUserMetadata("Test-queue-Metadata"); final SubscriptionProperties actual = EntityHelper.createSubscription(expected); assertEquals(expected.getTopicName(), actual.getTopicName()); assertEquals(expected.getSubscriptionName(), actual.getSubscriptionName()); assertEquals(expected.getAutoDeleteOnIdle(), actual.getAutoDeleteOnIdle()); assertEquals(expected.getDefaultMessageTimeToLive(), actual.getDefaultMessageTimeToLive()); assertEquals(expected.enableDeadLetteringOnFilterEvaluationExceptions(), actual.enableDeadLetteringOnFilterEvaluationExceptions()); assertEquals(expected.enableBatchedOperations(), actual.enableBatchedOperations()); assertEquals(expected.getUserMetadata(), actual.getUserMetadata()); assertEquals(expected.getStatus(), actual.getStatus()); }

Target:
void createSubscription() { final String topicName = "topic?"; final String subscriptionName = "subscription"; final CreateSubscriptionOptions expected = new CreateSubscriptionOptions(topicName, subscriptionName) .setAutoDeleteOnIdle(Duration.ofSeconds(15)) .setDefaultMessageTimeToLive(Duration.ofSeconds(50)) .setDeadLetteringOnMessageExpiration(true) .setEnableDeadLetteringOnFilterEvaluationExceptions(true) .setEnableBatchedOperations(false) .setForwardTo("Forward-To-This-Queue") .setForwardDeadLetteredMessagesTo("Dead-Lettered-Forward-To") .setLockDuration(Duration.ofSeconds(120)) .setMaxDeliveryCount(15) .setRequiresSession(true) .setStatus(EntityStatus.RECEIVE_DISABLED) .setUserMetadata("Test-topic-Metadata"); final SubscriptionDescription actual = EntityHelper.getSubscriptionDescription(expected); assertEquals(expected.getAutoDeleteOnIdle(), actual.getAutoDeleteOnIdle()); assertEquals(expected.getDefaultMessageTimeToLive(), actual.getDefaultMessageTimeToLive()); assertEquals(expected.deadLetteringOnMessageExpiration(), actual.isDeadLetteringOnMessageExpiration()); assertEquals(expected.enableBatchedOperations(), actual.isEnableBatchedOperations()); assertEquals(expected.enableDeadLetteringOnFilterEvaluationExceptions(), actual.isDeadLetteringOnFilterEvaluationExceptions()); assertEquals(expected.getForwardTo(), actual.getForwardTo()); assertEquals(expected.getForwardDeadLetteredMessagesTo(), actual.getForwardDeadLetteredMessagesTo()); assertEquals(expected.getLockDuration(), actual.getLockDuration()); assertEquals(expected.getMaxDeliveryCount(), actual.getMaxDeliveryCount()); assertEquals(expected.requiresSession(), actual.isRequiresSession()); assertEquals(expected.getUserMetadata(), actual.getUserMetadata()); assertEquals(expected.getStatus(), actual.getStatus()); }