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

package com.azure.resourcemanager.appcontainers.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.appcontainers.models.ForwardProxy;
import com.azure.resourcemanager.appcontainers.models.ForwardProxyConvention;
import com.azure.resourcemanager.appcontainers.models.HttpSettings;
import com.azure.resourcemanager.appcontainers.models.HttpSettingsRoutes;
import org.junit.jupiter.api.Assertions;

public final class HttpSettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        HttpSettings model =
            BinaryData
                .fromString(
                    "{\"requireHttps\":false,\"routes\":{\"apiPrefix\":\"yulpkudjkr\"},\"forwardProxy\":{\"convention\":\"Custom\",\"customHostHeaderName\":\"hfepgzgqex\",\"customProtoHeaderName\":\"ocxscpaierhhbcs\"}}")
                .toObject(HttpSettings.class);
        Assertions.assertEquals(false, model.requireHttps());
        Assertions.assertEquals("yulpkudjkr", model.routes().apiPrefix());
        Assertions.assertEquals(ForwardProxyConvention.CUSTOM, model.forwardProxy().convention());
        Assertions.assertEquals("hfepgzgqex", model.forwardProxy().customHostHeaderName());
        Assertions.assertEquals("ocxscpaierhhbcs", model.forwardProxy().customProtoHeaderName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        HttpSettings model =
            new HttpSettings()
                .withRequireHttps(false)
                .withRoutes(new HttpSettingsRoutes().withApiPrefix("yulpkudjkr"))
                .withForwardProxy(
                    new ForwardProxy()
                        .withConvention(ForwardProxyConvention.CUSTOM)
                        .withCustomHostHeaderName("hfepgzgqex")
                        .withCustomProtoHeaderName("ocxscpaierhhbcs"));
        model = BinaryData.fromObject(model).toObject(HttpSettings.class);
        Assertions.assertEquals(false, model.requireHttps());
        Assertions.assertEquals("yulpkudjkr", model.routes().apiPrefix());
        Assertions.assertEquals(ForwardProxyConvention.CUSTOM, model.forwardProxy().convention());
        Assertions.assertEquals("hfepgzgqex", model.forwardProxy().customHostHeaderName());
        Assertions.assertEquals("ocxscpaierhhbcs", model.forwardProxy().customProtoHeaderName());
    }
}
