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

package com.azure.resourcemanager.kusto.generated;

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

public final class EndpointDependencyTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        EndpointDependency model =
            BinaryData
                .fromString(
                    "{\"domainName\":\"mquxvypo\",\"endpointDetails\":[{\"port\":11863753},{\"port\":1364703724},{\"port\":1321769346},{\"port\":10985850}]}")
                .toObject(EndpointDependency.class);
        Assertions.assertEquals("mquxvypo", model.domainName());
        Assertions.assertEquals(11863753, model.endpointDetails().get(0).port());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        EndpointDependency model =
            new EndpointDependency()
                .withDomainName("mquxvypo")
                .withEndpointDetails(
                    Arrays
                        .asList(
                            new EndpointDetail().withPort(11863753),
                            new EndpointDetail().withPort(1364703724),
                            new EndpointDetail().withPort(1321769346),
                            new EndpointDetail().withPort(10985850)));
        model = BinaryData.fromObject(model).toObject(EndpointDependency.class);
        Assertions.assertEquals("mquxvypo", model.domainName());
        Assertions.assertEquals(11863753, model.endpointDetails().get(0).port());
    }
}
