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

package com.azure.resourcemanager.logic.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.logic.models.OpenAuthenticationAccessPolicy;
import com.azure.resourcemanager.logic.models.OpenAuthenticationPolicyClaim;
import com.azure.resourcemanager.logic.models.OpenAuthenticationProviderType;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OpenAuthenticationAccessPolicyTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OpenAuthenticationAccessPolicy model =
            BinaryData
                .fromString(
                    "{\"type\":\"AAD\",\"claims\":[{\"name\":\"sglumma\",\"value\":\"j\"},{\"name\":\"dxob\",\"value\":\"dxkqpx\"},{\"name\":\"ajionpimexgstxg\",\"value\":\"odgmaajrmvdjwz\"}]}")
                .toObject(OpenAuthenticationAccessPolicy.class);
        Assertions.assertEquals(OpenAuthenticationProviderType.AAD, model.type());
        Assertions.assertEquals("sglumma", model.claims().get(0).name());
        Assertions.assertEquals("j", model.claims().get(0).value());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OpenAuthenticationAccessPolicy model =
            new OpenAuthenticationAccessPolicy()
                .withType(OpenAuthenticationProviderType.AAD)
                .withClaims(
                    Arrays
                        .asList(
                            new OpenAuthenticationPolicyClaim().withName("sglumma").withValue("j"),
                            new OpenAuthenticationPolicyClaim().withName("dxob").withValue("dxkqpx"),
                            new OpenAuthenticationPolicyClaim()
                                .withName("ajionpimexgstxg")
                                .withValue("odgmaajrmvdjwz")));
        model = BinaryData.fromObject(model).toObject(OpenAuthenticationAccessPolicy.class);
        Assertions.assertEquals(OpenAuthenticationProviderType.AAD, model.type());
        Assertions.assertEquals("sglumma", model.claims().get(0).name());
        Assertions.assertEquals("j", model.claims().get(0).value());
    }
}
