// 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.DatadogHostListResponse;
import com.azure.resourcemanager.datadog.models.DatadogHostMetadata;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DatadogHostListResponseTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DatadogHostListResponse model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"name\":\"ahuxinpm\",\"aliases\":[\"aqwi\",\"jsprozvcpute\",\"jvwmfda\"],\"apps\":[\"mdvpjhulsu\"],\"meta\":{\"agentVersion\":\"kjozkrwfnd\"}},{\"name\":\"pslwejdpvw\",\"aliases\":[\"qpsoacctazak\",\"j\"],\"apps\":[\"bcryffdfd\",\"sy\",\"expa\",\"jakhmsbzjh\"],\"meta\":{\"agentVersion\":\"evdphlxaol\"}},{\"name\":\"rgqjbpfzfsinzg\",\"aliases\":[\"jrwzox\",\"j\",\"felluwfzitonpe\",\"fpjkjlxofp\"],\"apps\":[\"pfxxy\"],\"meta\":{\"agentVersion\":\"i\"}},{\"name\":\"huyb\",\"aliases\":[\"odepoogin\",\"vamih\"],\"apps\":[\"narxzxtheotus\",\"vyevcciqi\",\"nhungbw\"],\"meta\":{\"agentVersion\":\"nfygxgispemvtz\"}}],\"nextLink\":\"ubljofxqe\"}")
                .toObject(DatadogHostListResponse.class);
        Assertions.assertEquals("ahuxinpm", model.value().get(0).name());
        Assertions.assertEquals("aqwi", model.value().get(0).aliases().get(0));
        Assertions.assertEquals("mdvpjhulsu", model.value().get(0).apps().get(0));
        Assertions.assertEquals("kjozkrwfnd", model.value().get(0).meta().agentVersion());
        Assertions.assertEquals("ubljofxqe", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DatadogHostListResponse model =
            new DatadogHostListResponse()
                .withValue(
                    Arrays
                        .asList(
                            new DatadogHostInner()
                                .withName("ahuxinpm")
                                .withAliases(Arrays.asList("aqwi", "jsprozvcpute", "jvwmfda"))
                                .withApps(Arrays.asList("mdvpjhulsu"))
                                .withMeta(new DatadogHostMetadata().withAgentVersion("kjozkrwfnd")),
                            new DatadogHostInner()
                                .withName("pslwejdpvw")
                                .withAliases(Arrays.asList("qpsoacctazak", "j"))
                                .withApps(Arrays.asList("bcryffdfd", "sy", "expa", "jakhmsbzjh"))
                                .withMeta(new DatadogHostMetadata().withAgentVersion("evdphlxaol")),
                            new DatadogHostInner()
                                .withName("rgqjbpfzfsinzg")
                                .withAliases(Arrays.asList("jrwzox", "j", "felluwfzitonpe", "fpjkjlxofp"))
                                .withApps(Arrays.asList("pfxxy"))
                                .withMeta(new DatadogHostMetadata().withAgentVersion("i")),
                            new DatadogHostInner()
                                .withName("huyb")
                                .withAliases(Arrays.asList("odepoogin", "vamih"))
                                .withApps(Arrays.asList("narxzxtheotus", "vyevcciqi", "nhungbw"))
                                .withMeta(new DatadogHostMetadata().withAgentVersion("nfygxgispemvtz"))))
                .withNextLink("ubljofxqe");
        model = BinaryData.fromObject(model).toObject(DatadogHostListResponse.class);
        Assertions.assertEquals("ahuxinpm", model.value().get(0).name());
        Assertions.assertEquals("aqwi", model.value().get(0).aliases().get(0));
        Assertions.assertEquals("mdvpjhulsu", model.value().get(0).apps().get(0));
        Assertions.assertEquals("kjozkrwfnd", model.value().get(0).meta().agentVersion());
        Assertions.assertEquals("ubljofxqe", model.nextLink());
    }
}
