// 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.FrontendEndpointUpdateParameters;
import com.azure.resourcemanager.frontdoor.models.FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink;
import com.azure.resourcemanager.frontdoor.models.SessionAffinityEnabledState;
import org.junit.jupiter.api.Assertions;

public final class FrontendEndpointUpdateParametersTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        FrontendEndpointUpdateParameters model =
            BinaryData
                .fromString(
                    "{\"hostName\":\"sytgadgvraea\",\"sessionAffinityEnabledState\":\"Enabled\",\"sessionAffinityTtlSeconds\":999689633,\"webApplicationFirewallPolicyLink\":{\"id\":\"rrwlquuijfqkace\"}}")
                .toObject(FrontendEndpointUpdateParameters.class);
        Assertions.assertEquals("sytgadgvraea", model.hostname());
        Assertions.assertEquals(SessionAffinityEnabledState.ENABLED, model.sessionAffinityEnabledState());
        Assertions.assertEquals(999689633, model.sessionAffinityTtlSeconds());
        Assertions.assertEquals("rrwlquuijfqkace", model.webApplicationFirewallPolicyLink().id());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        FrontendEndpointUpdateParameters model =
            new FrontendEndpointUpdateParameters()
                .withHostname("sytgadgvraea")
                .withSessionAffinityEnabledState(SessionAffinityEnabledState.ENABLED)
                .withSessionAffinityTtlSeconds(999689633)
                .withWebApplicationFirewallPolicyLink(
                    new FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink().withId("rrwlquuijfqkace"));
        model = BinaryData.fromObject(model).toObject(FrontendEndpointUpdateParameters.class);
        Assertions.assertEquals("sytgadgvraea", model.hostname());
        Assertions.assertEquals(SessionAffinityEnabledState.ENABLED, model.sessionAffinityEnabledState());
        Assertions.assertEquals(999689633, model.sessionAffinityTtlSeconds());
        Assertions.assertEquals("rrwlquuijfqkace", model.webApplicationFirewallPolicyLink().id());
    }
}
