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

package com.azure.resourcemanager.timeseriesinsights.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.timeseriesinsights.fluent.models.AccessPolicyMutableProperties;
import com.azure.resourcemanager.timeseriesinsights.models.AccessPolicyRole;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AccessPolicyMutablePropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AccessPolicyMutableProperties model =
            BinaryData
                .fromString("{\"description\":\"ywqsmbsurexim\",\"roles\":[\"Reader\"]}")
                .toObject(AccessPolicyMutableProperties.class);
        Assertions.assertEquals("ywqsmbsurexim", model.description());
        Assertions.assertEquals(AccessPolicyRole.READER, model.roles().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AccessPolicyMutableProperties model =
            new AccessPolicyMutableProperties()
                .withDescription("ywqsmbsurexim")
                .withRoles(Arrays.asList(AccessPolicyRole.READER));
        model = BinaryData.fromObject(model).toObject(AccessPolicyMutableProperties.class);
        Assertions.assertEquals("ywqsmbsurexim", model.description());
        Assertions.assertEquals(AccessPolicyRole.READER, model.roles().get(0));
    }
}
