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

package com.azure.resourcemanager.webpubsub.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.webpubsub.models.ManagedIdentitySettings;
import com.azure.resourcemanager.webpubsub.models.UpstreamAuthSettings;
import com.azure.resourcemanager.webpubsub.models.UpstreamAuthType;
import org.junit.jupiter.api.Assertions;

public final class UpstreamAuthSettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        UpstreamAuthSettings model =
            BinaryData
                .fromString("{\"type\":\"None\",\"managedIdentity\":{\"resource\":\"fbjfdtwssotftpvj\"}}")
                .toObject(UpstreamAuthSettings.class);
        Assertions.assertEquals(UpstreamAuthType.NONE, model.type());
        Assertions.assertEquals("fbjfdtwssotftpvj", model.managedIdentity().resource());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        UpstreamAuthSettings model =
            new UpstreamAuthSettings()
                .withType(UpstreamAuthType.NONE)
                .withManagedIdentity(new ManagedIdentitySettings().withResource("fbjfdtwssotftpvj"));
        model = BinaryData.fromObject(model).toObject(UpstreamAuthSettings.class);
        Assertions.assertEquals(UpstreamAuthType.NONE, model.type());
        Assertions.assertEquals("fbjfdtwssotftpvj", model.managedIdentity().resource());
    }
}
