// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.iothub.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.iothub.models.FeedbackProperties;
import java.time.Duration;
import org.junit.jupiter.api.Assertions;

public final class FeedbackPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        FeedbackProperties model =
            BinaryData
                .fromString(
                    "{\"lockDurationAsIso8601\":\"PT19H28M11S\",\"ttlAsIso8601\":\"PT104H38M10S\",\"maxDeliveryCount\":1236632858}")
                .toObject(FeedbackProperties.class);
        Assertions.assertEquals(Duration.parse("PT19H28M11S"), model.lockDurationAsIso8601());
        Assertions.assertEquals(Duration.parse("PT104H38M10S"), model.ttlAsIso8601());
        Assertions.assertEquals(1236632858, model.maxDeliveryCount());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        FeedbackProperties model =
            new FeedbackProperties()
                .withLockDurationAsIso8601(Duration.parse("PT19H28M11S"))
                .withTtlAsIso8601(Duration.parse("PT104H38M10S"))
                .withMaxDeliveryCount(1236632858);
        model = BinaryData.fromObject(model).toObject(FeedbackProperties.class);
        Assertions.assertEquals(Duration.parse("PT19H28M11S"), model.lockDurationAsIso8601());
        Assertions.assertEquals(Duration.parse("PT104H38M10S"), model.ttlAsIso8601());
        Assertions.assertEquals(1236632858, model.maxDeliveryCount());
    }
}
