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

package com.azure.resourcemanager.quota.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.quota.fluent.models.CurrentQuotaLimitBaseInner;
import com.azure.resourcemanager.quota.models.QuotaLimits;
import com.azure.resourcemanager.quota.models.QuotaProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class QuotaLimitsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        QuotaLimits model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"unit\":\"npmqnjaqwixjspro\",\"resourceType\":\"putegjvwmfd\",\"quotaPeriod\":\"scmdvpjhulsuu\",\"isQuotaApplicable\":true,\"properties\":\"dataozkrwfndiodjpslw\"},\"id\":\"jdpvwryo\",\"name\":\"psoacctazakljl\",\"type\":\"hbcryffdfdosyge\"},{\"properties\":{\"unit\":\"jakhmsbzjh\",\"resourceType\":\"evdphlxaol\",\"quotaPeriod\":\"qtrgqjbpfzfsinzg\",\"isQuotaApplicable\":true,\"properties\":\"datarwzoxxjtfelluwf\"},\"id\":\"it\",\"name\":\"np\",\"type\":\"qfpjk\"},{\"properties\":{\"unit\":\"fpdvhpfxxypi\",\"resourceType\":\"mayhuybbkpodepoo\",\"quotaPeriod\":\"nuvamiheogna\",\"isQuotaApplicable\":true,\"properties\":\"datatheotusiv\"},\"id\":\"evcciqihnhun\",\"name\":\"bwjzr\",\"type\":\"fygxgispemvtzfk\"}],\"nextLink\":\"ubljofxqe\"}")
                .toObject(QuotaLimits.class);
        Assertions.assertEquals("putegjvwmfd", model.value().get(0).properties().resourceType());
        Assertions.assertEquals("ubljofxqe", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        QuotaLimits model =
            new QuotaLimits()
                .withValue(
                    Arrays
                        .asList(
                            new CurrentQuotaLimitBaseInner()
                                .withProperties(
                                    new QuotaProperties()
                                        .withResourceType("putegjvwmfd")
                                        .withProperties("dataozkrwfndiodjpslw")),
                            new CurrentQuotaLimitBaseInner()
                                .withProperties(
                                    new QuotaProperties()
                                        .withResourceType("evdphlxaol")
                                        .withProperties("datarwzoxxjtfelluwf")),
                            new CurrentQuotaLimitBaseInner()
                                .withProperties(
                                    new QuotaProperties()
                                        .withResourceType("mayhuybbkpodepoo")
                                        .withProperties("datatheotusiv"))))
                .withNextLink("ubljofxqe");
        model = BinaryData.fromObject(model).toObject(QuotaLimits.class);
        Assertions.assertEquals("putegjvwmfd", model.value().get(0).properties().resourceType());
        Assertions.assertEquals("ubljofxqe", model.nextLink());
    }
}
