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

package com.azure.resourcemanager.networkcloud.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.networkcloud.models.EgressEndpoint;
import com.azure.resourcemanager.networkcloud.models.EndpointDependency;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class EgressEndpointTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        EgressEndpoint model =
            BinaryData
                .fromString(
                    "{\"category\":\"rpmopjmc\",\"endpoints\":[{\"domainName\":\"tuo\",\"port\":2607649356608262418},{\"domainName\":\"uiuaodsfcpkvxodp\",\"port\":784151733516976899},{\"domainName\":\"yzydagfuaxbezyi\",\"port\":13185464662023528}]}")
                .toObject(EgressEndpoint.class);
        Assertions.assertEquals("rpmopjmc", model.category());
        Assertions.assertEquals("tuo", model.endpoints().get(0).domainName());
        Assertions.assertEquals(2607649356608262418L, model.endpoints().get(0).port());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        EgressEndpoint model =
            new EgressEndpoint()
                .withCategory("rpmopjmc")
                .withEndpoints(
                    Arrays
                        .asList(
                            new EndpointDependency().withDomainName("tuo").withPort(2607649356608262418L),
                            new EndpointDependency().withDomainName("uiuaodsfcpkvxodp").withPort(784151733516976899L),
                            new EndpointDependency().withDomainName("yzydagfuaxbezyi").withPort(13185464662023528L)));
        model = BinaryData.fromObject(model).toObject(EgressEndpoint.class);
        Assertions.assertEquals("rpmopjmc", model.category());
        Assertions.assertEquals("tuo", model.endpoints().get(0).domainName());
        Assertions.assertEquals(2607649356608262418L, model.endpoints().get(0).port());
    }
}
