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

package com.azure.resourcemanager.machinelearning.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.machinelearning.models.FqdnEndpoint;
import com.azure.resourcemanager.machinelearning.models.FqdnEndpoints;
import com.azure.resourcemanager.machinelearning.models.FqdnEndpointsProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class FqdnEndpointsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        FqdnEndpoints model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"category\":\"qqkdltfzxmhhvhgu\",\"endpoints\":[{\"domainName\":\"kwobdagxtibq\",\"endpointDetails\":[]},{\"domainName\":\"xwak\",\"endpointDetails\":[]}]}}")
                .toObject(FqdnEndpoints.class);
        Assertions.assertEquals("qqkdltfzxmhhvhgu", model.properties().category());
        Assertions.assertEquals("kwobdagxtibq", model.properties().endpoints().get(0).domainName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        FqdnEndpoints model =
            new FqdnEndpoints()
                .withProperties(
                    new FqdnEndpointsProperties()
                        .withCategory("qqkdltfzxmhhvhgu")
                        .withEndpoints(
                            Arrays
                                .asList(
                                    new FqdnEndpoint()
                                        .withDomainName("kwobdagxtibq")
                                        .withEndpointDetails(Arrays.asList()),
                                    new FqdnEndpoint().withDomainName("xwak").withEndpointDetails(Arrays.asList()))));
        model = BinaryData.fromObject(model).toObject(FqdnEndpoints.class);
        Assertions.assertEquals("qqkdltfzxmhhvhgu", model.properties().category());
        Assertions.assertEquals("kwobdagxtibq", model.properties().endpoints().get(0).domainName());
    }
}
