// 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.models.DatadogHostMetadata;
import com.azure.resourcemanager.datadog.models.DatadogInstallMethod;
import com.azure.resourcemanager.datadog.models.DatadogLogsAgent;
import org.junit.jupiter.api.Assertions;

public final class DatadogHostMetadataTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DatadogHostMetadata model =
            BinaryData
                .fromString(
                    "{\"agentVersion\":\"bdkvwrwjf\",\"installMethod\":{\"tool\":\"nhutjeltmrldhugj\",\"toolVersion\":\"datqxhocdgeabl\",\"installerVersion\":\"huticndvkao\"},\"logsAgent\":{\"transport\":\"i\"}}")
                .toObject(DatadogHostMetadata.class);
        Assertions.assertEquals("bdkvwrwjf", model.agentVersion());
        Assertions.assertEquals("nhutjeltmrldhugj", model.installMethod().tool());
        Assertions.assertEquals("datqxhocdgeabl", model.installMethod().toolVersion());
        Assertions.assertEquals("huticndvkao", model.installMethod().installerVersion());
        Assertions.assertEquals("i", model.logsAgent().transport());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DatadogHostMetadata model =
            new DatadogHostMetadata()
                .withAgentVersion("bdkvwrwjf")
                .withInstallMethod(
                    new DatadogInstallMethod()
                        .withTool("nhutjeltmrldhugj")
                        .withToolVersion("datqxhocdgeabl")
                        .withInstallerVersion("huticndvkao"))
                .withLogsAgent(new DatadogLogsAgent().withTransport("i"));
        model = BinaryData.fromObject(model).toObject(DatadogHostMetadata.class);
        Assertions.assertEquals("bdkvwrwjf", model.agentVersion());
        Assertions.assertEquals("nhutjeltmrldhugj", model.installMethod().tool());
        Assertions.assertEquals("datqxhocdgeabl", model.installMethod().toolVersion());
        Assertions.assertEquals("huticndvkao", model.installMethod().installerVersion());
        Assertions.assertEquals("i", model.logsAgent().transport());
    }
}
