// 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.IntegrationServiceEnvironmentNetworkDependency;
import com.azure.resourcemanager.logic.models.IntegrationServiceEnvironmentNetworkDependencyCategoryType;
import com.azure.resourcemanager.logic.models.IntegrationServiceEnvironmentNetworkEndPointAccessibilityState;
import com.azure.resourcemanager.logic.models.IntegrationServiceEnvironmentNetworkEndpoint;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class IntegrationServiceEnvironmentNetworkDependencyTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        IntegrationServiceEnvironmentNetworkDependency model =
            BinaryData
                .fromString(
                    "{\"category\":\"NotSpecified\",\"displayName\":\"adijaeukmrsie\",\"endpoints\":[{\"accessibility\":\"Available\",\"domainName\":\"aapm\",\"ports\":[\"meqwig\",\"ibudqwy\",\"eb\",\"ybpmzznrtffyaq\"]},{\"accessibility\":\"NotSpecified\",\"domainName\":\"heioqa\",\"ports\":[\"seufuqy\"]},{\"accessibility\":\"NotSpecified\",\"domainName\":\"lcgqlsismj\",\"ports\":[\"ddgamquhiosr\",\"ju\"]},{\"accessibility\":\"Unknown\",\"domainName\":\"disyirnxz\",\"ports\":[\"exrxzbujrtrhq\",\"wrevkhgnlnzon\",\"lrpiqywnc\"]}]}")
                .toObject(IntegrationServiceEnvironmentNetworkDependency.class);
        Assertions
            .assertEquals(IntegrationServiceEnvironmentNetworkDependencyCategoryType.NOT_SPECIFIED, model.category());
        Assertions.assertEquals("adijaeukmrsie", model.displayName());
        Assertions
            .assertEquals(
                IntegrationServiceEnvironmentNetworkEndPointAccessibilityState.AVAILABLE,
                model.endpoints().get(0).accessibility());
        Assertions.assertEquals("aapm", model.endpoints().get(0).domainName());
        Assertions.assertEquals("meqwig", model.endpoints().get(0).ports().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        IntegrationServiceEnvironmentNetworkDependency model =
            new IntegrationServiceEnvironmentNetworkDependency()
                .withCategory(IntegrationServiceEnvironmentNetworkDependencyCategoryType.NOT_SPECIFIED)
                .withDisplayName("adijaeukmrsie")
                .withEndpoints(
                    Arrays
                        .asList(
                            new IntegrationServiceEnvironmentNetworkEndpoint()
                                .withAccessibility(
                                    IntegrationServiceEnvironmentNetworkEndPointAccessibilityState.AVAILABLE)
                                .withDomainName("aapm")
                                .withPorts(Arrays.asList("meqwig", "ibudqwy", "eb", "ybpmzznrtffyaq")),
                            new IntegrationServiceEnvironmentNetworkEndpoint()
                                .withAccessibility(
                                    IntegrationServiceEnvironmentNetworkEndPointAccessibilityState.NOT_SPECIFIED)
                                .withDomainName("heioqa")
                                .withPorts(Arrays.asList("seufuqy")),
                            new IntegrationServiceEnvironmentNetworkEndpoint()
                                .withAccessibility(
                                    IntegrationServiceEnvironmentNetworkEndPointAccessibilityState.NOT_SPECIFIED)
                                .withDomainName("lcgqlsismj")
                                .withPorts(Arrays.asList("ddgamquhiosr", "ju")),
                            new IntegrationServiceEnvironmentNetworkEndpoint()
                                .withAccessibility(
                                    IntegrationServiceEnvironmentNetworkEndPointAccessibilityState.UNKNOWN)
                                .withDomainName("disyirnxz")
                                .withPorts(Arrays.asList("exrxzbujrtrhq", "wrevkhgnlnzon", "lrpiqywnc"))));
        model = BinaryData.fromObject(model).toObject(IntegrationServiceEnvironmentNetworkDependency.class);
        Assertions
            .assertEquals(IntegrationServiceEnvironmentNetworkDependencyCategoryType.NOT_SPECIFIED, model.category());
        Assertions.assertEquals("adijaeukmrsie", model.displayName());
        Assertions
            .assertEquals(
                IntegrationServiceEnvironmentNetworkEndPointAccessibilityState.AVAILABLE,
                model.endpoints().get(0).accessibility());
        Assertions.assertEquals("aapm", model.endpoints().get(0).domainName());
        Assertions.assertEquals("meqwig", model.endpoints().get(0).ports().get(0));
    }
}
