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

package com.azure.resourcemanager.frontdoor.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.frontdoor.models.CacheConfiguration;
import com.azure.resourcemanager.frontdoor.models.DynamicCompressionEnabled;
import com.azure.resourcemanager.frontdoor.models.FrontDoorQuery;
import java.time.Duration;
import org.junit.jupiter.api.Assertions;

public final class CacheConfigurationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CacheConfiguration model =
            BinaryData
                .fromString(
                    "{\"queryParameterStripDirective\":\"StripOnly\",\"queryParameters\":\"xhojuj\",\"dynamicCompression\":\"Disabled\",\"cacheDuration\":\"PT46H54M10S\"}")
                .toObject(CacheConfiguration.class);
        Assertions.assertEquals(FrontDoorQuery.STRIP_ONLY, model.queryParameterStripDirective());
        Assertions.assertEquals("xhojuj", model.queryParameters());
        Assertions.assertEquals(DynamicCompressionEnabled.DISABLED, model.dynamicCompression());
        Assertions.assertEquals(Duration.parse("PT46H54M10S"), model.cacheDuration());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CacheConfiguration model =
            new CacheConfiguration()
                .withQueryParameterStripDirective(FrontDoorQuery.STRIP_ONLY)
                .withQueryParameters("xhojuj")
                .withDynamicCompression(DynamicCompressionEnabled.DISABLED)
                .withCacheDuration(Duration.parse("PT46H54M10S"));
        model = BinaryData.fromObject(model).toObject(CacheConfiguration.class);
        Assertions.assertEquals(FrontDoorQuery.STRIP_ONLY, model.queryParameterStripDirective());
        Assertions.assertEquals("xhojuj", model.queryParameters());
        Assertions.assertEquals(DynamicCompressionEnabled.DISABLED, model.dynamicCompression());
        Assertions.assertEquals(Duration.parse("PT46H54M10S"), model.cacheDuration());
    }
}
