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

package com.azure.resourcemanager.elastic.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionListFormatInner;
import com.azure.resourcemanager.elastic.models.ElasticVersionListProperties;
import com.azure.resourcemanager.elastic.models.ElasticVersionsListResponse;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ElasticVersionsListResponseTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ElasticVersionsListResponse model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"version\":\"zndlikwy\"}},{\"properties\":{\"version\":\"fgibmadgakeq\"}},{\"properties\":{\"version\":\"yb\"}}],\"nextLink\":\"qedqytbciqfoufl\"}")
                .toObject(ElasticVersionsListResponse.class);
        Assertions.assertEquals("zndlikwy", model.value().get(0).properties().version());
        Assertions.assertEquals("qedqytbciqfoufl", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ElasticVersionsListResponse model =
            new ElasticVersionsListResponse()
                .withValue(
                    Arrays
                        .asList(
                            new ElasticVersionListFormatInner()
                                .withProperties(new ElasticVersionListProperties().withVersion("zndlikwy")),
                            new ElasticVersionListFormatInner()
                                .withProperties(new ElasticVersionListProperties().withVersion("fgibmadgakeq")),
                            new ElasticVersionListFormatInner()
                                .withProperties(new ElasticVersionListProperties().withVersion("yb"))))
                .withNextLink("qedqytbciqfoufl");
        model = BinaryData.fromObject(model).toObject(ElasticVersionsListResponse.class);
        Assertions.assertEquals("zndlikwy", model.value().get(0).properties().version());
        Assertions.assertEquals("qedqytbciqfoufl", model.nextLink());
    }
}
