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

package com.azure.resourcemanager.datadog.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.datadog.fluent.models.DatadogHostInner;
import com.azure.resourcemanager.datadog.models.DatadogHostMetadata;
import com.azure.resourcemanager.datadog.models.DatadogInstallMethod;
import com.azure.resourcemanager.datadog.models.DatadogLogsAgent;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DatadogHostInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DatadogHostInner model =
            BinaryData
                .fromString(
                    "{\"name\":\"jaeq\",\"aliases\":[\"jbasvmsmjqulngs\",\"tnb\"],\"apps\":[\"zgcwrw\",\"lxxwrljdouskc\",\"vkocrcjdkwtn\"],\"meta\":{\"agentVersion\":\"njbiksqrglssain\",\"installMethod\":{\"tool\":\"wnzlljfmppeeb\",\"toolVersion\":\"gxsabkyq\",\"installerVersion\":\"ujitcjcz\"},\"logsAgent\":{\"transport\":\"vndhkrwpdapp\"}}}")
                .toObject(DatadogHostInner.class);
        Assertions.assertEquals("jaeq", model.name());
        Assertions.assertEquals("jbasvmsmjqulngs", model.aliases().get(0));
        Assertions.assertEquals("zgcwrw", model.apps().get(0));
        Assertions.assertEquals("njbiksqrglssain", model.meta().agentVersion());
        Assertions.assertEquals("wnzlljfmppeeb", model.meta().installMethod().tool());
        Assertions.assertEquals("gxsabkyq", model.meta().installMethod().toolVersion());
        Assertions.assertEquals("ujitcjcz", model.meta().installMethod().installerVersion());
        Assertions.assertEquals("vndhkrwpdapp", model.meta().logsAgent().transport());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DatadogHostInner model =
            new DatadogHostInner()
                .withName("jaeq")
                .withAliases(Arrays.asList("jbasvmsmjqulngs", "tnb"))
                .withApps(Arrays.asList("zgcwrw", "lxxwrljdouskc", "vkocrcjdkwtn"))
                .withMeta(
                    new DatadogHostMetadata()
                        .withAgentVersion("njbiksqrglssain")
                        .withInstallMethod(
                            new DatadogInstallMethod()
                                .withTool("wnzlljfmppeeb")
                                .withToolVersion("gxsabkyq")
                                .withInstallerVersion("ujitcjcz"))
                        .withLogsAgent(new DatadogLogsAgent().withTransport("vndhkrwpdapp")));
        model = BinaryData.fromObject(model).toObject(DatadogHostInner.class);
        Assertions.assertEquals("jaeq", model.name());
        Assertions.assertEquals("jbasvmsmjqulngs", model.aliases().get(0));
        Assertions.assertEquals("zgcwrw", model.apps().get(0));
        Assertions.assertEquals("njbiksqrglssain", model.meta().agentVersion());
        Assertions.assertEquals("wnzlljfmppeeb", model.meta().installMethod().tool());
        Assertions.assertEquals("gxsabkyq", model.meta().installMethod().toolVersion());
        Assertions.assertEquals("ujitcjcz", model.meta().installMethod().installerVersion());
        Assertions.assertEquals("vndhkrwpdapp", model.meta().logsAgent().transport());
    }
}
