// 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.L2IsolationDomainInner;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Assertions;

public final class L2IsolationDomainInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        L2IsolationDomainInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"networkFabricId\":\"mvfaxkffeiith\",\"vlanId\":1335902799,\"mtu\":504857780,\"disabledOnResources\":[\"v\",\"hxmzsbbzoggig\"],\"administrativeState\":\"Disabled\",\"provisioningState\":\"Deleting\",\"annotation\":\"vjxxjnsp\"},\"location\":\"ptkoenkoukn\",\"tags\":{\"kpoc\":\"wtiukbldn\",\"npiucgygevqznty\":\"pazyxoegukg\",\"dpydn\":\"mrbpizcdrqj\",\"sjttgzfbish\":\"yhxdeoejzicwi\"},\"id\":\"bkh\",\"name\":\"jdeyeamdpha\",\"type\":\"alpbuxwgipwhon\"}")
                .toObject(L2IsolationDomainInner.class);
        Assertions.assertEquals("ptkoenkoukn", model.location());
        Assertions.assertEquals("wtiukbldn", model.tags().get("kpoc"));
        Assertions.assertEquals("mvfaxkffeiith", model.networkFabricId());
        Assertions.assertEquals(1335902799, model.vlanId());
        Assertions.assertEquals(504857780, model.mtu());
        Assertions.assertEquals("vjxxjnsp", model.annotation());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        L2IsolationDomainInner model =
            new L2IsolationDomainInner()
                .withLocation("ptkoenkoukn")
                .withTags(
                    mapOf(
                        "kpoc",
                        "wtiukbldn",
                        "npiucgygevqznty",
                        "pazyxoegukg",
                        "dpydn",
                        "mrbpizcdrqj",
                        "sjttgzfbish",
                        "yhxdeoejzicwi"))
                .withNetworkFabricId("mvfaxkffeiith")
                .withVlanId(1335902799)
                .withMtu(504857780)
                .withAnnotation("vjxxjnsp");
        model = BinaryData.fromObject(model).toObject(L2IsolationDomainInner.class);
        Assertions.assertEquals("ptkoenkoukn", model.location());
        Assertions.assertEquals("wtiukbldn", model.tags().get("kpoc"));
        Assertions.assertEquals("mvfaxkffeiith", model.networkFabricId());
        Assertions.assertEquals(1335902799, model.vlanId());
        Assertions.assertEquals(504857780, model.mtu());
        Assertions.assertEquals("vjxxjnsp", model.annotation());
    }

    @SuppressWarnings("unchecked")
    private static <T> Map<String, T> mapOf(Object... inputs) {
        Map<String, T> map = new HashMap<>();
        for (int i = 0; i < inputs.length; i += 2) {
            String key = (String) inputs[i];
            T value = (T) inputs[i + 1];
            map.put(key, value);
        }
        return map;
    }
}
