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

package com.azure.resourcemanager.batch.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.batch.fluent.models.ApplicationInner;
import com.azure.resourcemanager.batch.models.ListApplicationsResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class ListApplicationsResultTests {
    @Test
    public void testDeserialize() {
        ListApplicationsResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"displayName\":\"zloc\",\"allowUpdates\":false,\"defaultVersion\":\"aierhhb\"},\"etag\":\"glu\",\"id\":\"majtjaod\",\"name\":\"obnbdxkqpxokaj\",\"type\":\"onpimexgstxg\"}],\"nextLink\":\"odgmaajrmvdjwz\"}")
                .toObject(ListApplicationsResult.class);
        Assertions.assertEquals("zloc", model.value().get(0).displayName());
        Assertions.assertEquals(false, model.value().get(0).allowUpdates());
        Assertions.assertEquals("aierhhb", model.value().get(0).defaultVersion());
        Assertions.assertEquals("odgmaajrmvdjwz", model.nextLink());
    }

    @Test
    public void testSerialize() {
        ListApplicationsResult model =
            new ListApplicationsResult()
                .withValue(
                    Arrays
                        .asList(
                            new ApplicationInner()
                                .withDisplayName("zloc")
                                .withAllowUpdates(false)
                                .withDefaultVersion("aierhhb")))
                .withNextLink("odgmaajrmvdjwz");
        model = BinaryData.fromObject(model).toObject(ListApplicationsResult.class);
        Assertions.assertEquals("zloc", model.value().get(0).displayName());
        Assertions.assertEquals(false, model.value().get(0).allowUpdates());
        Assertions.assertEquals("aierhhb", model.value().get(0).defaultVersion());
        Assertions.assertEquals("odgmaajrmvdjwz", model.nextLink());
    }
}
