// 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.FrontDoorRedirectProtocol;
import com.azure.resourcemanager.frontdoor.models.FrontDoorRedirectType;
import com.azure.resourcemanager.frontdoor.models.RedirectConfiguration;
import org.junit.jupiter.api.Assertions;

public final class RedirectConfigurationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        RedirectConfiguration model =
            BinaryData
                .fromString(
                    "{\"@odata.type\":\"#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration\",\"redirectType\":\"Moved\",\"redirectProtocol\":\"HttpsOnly\",\"customHost\":\"ixbjx\",\"customPath\":\"w\",\"customFragment\":\"lrcoolsttpki\",\"customQueryString\":\"kbnujr\"}")
                .toObject(RedirectConfiguration.class);
        Assertions.assertEquals(FrontDoorRedirectType.MOVED, model.redirectType());
        Assertions.assertEquals(FrontDoorRedirectProtocol.HTTPS_ONLY, model.redirectProtocol());
        Assertions.assertEquals("ixbjx", model.customHost());
        Assertions.assertEquals("w", model.customPath());
        Assertions.assertEquals("lrcoolsttpki", model.customFragment());
        Assertions.assertEquals("kbnujr", model.customQueryString());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        RedirectConfiguration model =
            new RedirectConfiguration()
                .withRedirectType(FrontDoorRedirectType.MOVED)
                .withRedirectProtocol(FrontDoorRedirectProtocol.HTTPS_ONLY)
                .withCustomHost("ixbjx")
                .withCustomPath("w")
                .withCustomFragment("lrcoolsttpki")
                .withCustomQueryString("kbnujr");
        model = BinaryData.fromObject(model).toObject(RedirectConfiguration.class);
        Assertions.assertEquals(FrontDoorRedirectType.MOVED, model.redirectType());
        Assertions.assertEquals(FrontDoorRedirectProtocol.HTTPS_ONLY, model.redirectProtocol());
        Assertions.assertEquals("ixbjx", model.customHost());
        Assertions.assertEquals("w", model.customPath());
        Assertions.assertEquals("lrcoolsttpki", model.customFragment());
        Assertions.assertEquals("kbnujr", model.customQueryString());
    }
}
