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

package com.azure.resourcemanager.appcontainers.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.appcontainers.fluent.models.JobExecutionBaseInner;
import com.azure.resourcemanager.appcontainers.models.JobExecutionNamesCollection;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class JobExecutionNamesCollectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        JobExecutionNamesCollection model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"name\":\"ewzcjznmwcp\",\"id\":\"uaadraufactkahzo\"},{\"name\":\"jjziuxxpsh\",\"id\":\"e\"},{\"name\":\"lfg\",\"id\":\"qubkw\"},{\"name\":\"enr\",\"id\":\"utujba\"}]}")
                .toObject(JobExecutionNamesCollection.class);
        Assertions.assertEquals("ewzcjznmwcp", model.value().get(0).name());
        Assertions.assertEquals("uaadraufactkahzo", model.value().get(0).id());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        JobExecutionNamesCollection model =
            new JobExecutionNamesCollection()
                .withValue(
                    Arrays
                        .asList(
                            new JobExecutionBaseInner().withName("ewzcjznmwcp").withId("uaadraufactkahzo"),
                            new JobExecutionBaseInner().withName("jjziuxxpsh").withId("e"),
                            new JobExecutionBaseInner().withName("lfg").withId("qubkw"),
                            new JobExecutionBaseInner().withName("enr").withId("utujba")));
        model = BinaryData.fromObject(model).toObject(JobExecutionNamesCollection.class);
        Assertions.assertEquals("ewzcjznmwcp", model.value().get(0).name());
        Assertions.assertEquals("uaadraufactkahzo", model.value().get(0).id());
    }
}
