// 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.models.ActionIpCommunityProperties;
import com.azure.resourcemanager.managednetworkfabric.models.IpCommunityIdList;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ActionIpCommunityPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ActionIpCommunityProperties model =
            BinaryData
                .fromString(
                    "{\"delete\":{\"ipCommunityIds\":[\"qxeiiqbimhtmwwi\",\"h\",\"hfqpofv\"]},\"set\":{\"ipCommunityIds\":[\"lembnkbwvqvxkdi\",\"qihebw\",\"swbzuwfmdurage\",\"izvcjfe\"]},\"add\":{\"ipCommunityIds\":[\"jubggbqigkxkb\"]}}")
                .toObject(ActionIpCommunityProperties.class);
        Assertions.assertEquals("jubggbqigkxkb", model.add().ipCommunityIds().get(0));
        Assertions.assertEquals("qxeiiqbimhtmwwi", model.delete().ipCommunityIds().get(0));
        Assertions.assertEquals("lembnkbwvqvxkdi", model.set().ipCommunityIds().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ActionIpCommunityProperties model =
            new ActionIpCommunityProperties()
                .withAdd(new IpCommunityIdList().withIpCommunityIds(Arrays.asList("jubggbqigkxkb")))
                .withDelete(
                    new IpCommunityIdList().withIpCommunityIds(Arrays.asList("qxeiiqbimhtmwwi", "h", "hfqpofv")))
                .withSet(
                    new IpCommunityIdList()
                        .withIpCommunityIds(Arrays.asList("lembnkbwvqvxkdi", "qihebw", "swbzuwfmdurage", "izvcjfe")));
        model = BinaryData.fromObject(model).toObject(ActionIpCommunityProperties.class);
        Assertions.assertEquals("jubggbqigkxkb", model.add().ipCommunityIds().get(0));
        Assertions.assertEquals("qxeiiqbimhtmwwi", model.delete().ipCommunityIds().get(0));
        Assertions.assertEquals("lembnkbwvqvxkdi", model.set().ipCommunityIds().get(0));
    }
}
