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

package com.azure.resourcemanager.managednetworkfabric.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.managednetworkfabric.fluent.models.IpCommunityProperties;
import com.azure.resourcemanager.managednetworkfabric.models.CommunityActionTypes;
import com.azure.resourcemanager.managednetworkfabric.models.WellKnownCommunities;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class IpCommunityPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        IpCommunityProperties model =
            BinaryData
                .fromString(
                    "{\"action\":\"Permit\",\"wellKnownCommunities\":[\"LocalAS\",\"GShut\"],\"communityMembers\":[\"itnwuizgazxufi\",\"uckyf\"],\"provisioningState\":\"Updating\",\"annotation\":\"idf\"}")
                .toObject(IpCommunityProperties.class);
        Assertions.assertEquals("idf", model.annotation());
        Assertions.assertEquals(CommunityActionTypes.PERMIT, model.action());
        Assertions.assertEquals(WellKnownCommunities.LOCAL_AS, model.wellKnownCommunities().get(0));
        Assertions.assertEquals("itnwuizgazxufi", model.communityMembers().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        IpCommunityProperties model =
            new IpCommunityProperties()
                .withAnnotation("idf")
                .withAction(CommunityActionTypes.PERMIT)
                .withWellKnownCommunities(Arrays.asList(WellKnownCommunities.LOCAL_AS, WellKnownCommunities.GSHUT))
                .withCommunityMembers(Arrays.asList("itnwuizgazxufi", "uckyf"));
        model = BinaryData.fromObject(model).toObject(IpCommunityProperties.class);
        Assertions.assertEquals("idf", model.annotation());
        Assertions.assertEquals(CommunityActionTypes.PERMIT, model.action());
        Assertions.assertEquals(WellKnownCommunities.LOCAL_AS, model.wellKnownCommunities().get(0));
        Assertions.assertEquals("itnwuizgazxufi", model.communityMembers().get(0));
    }
}
