// 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.BillingMeterCollectionInner;
import com.azure.resourcemanager.appcontainers.models.BillingMeter;
import com.azure.resourcemanager.appcontainers.models.BillingMeterProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class BillingMeterCollectionInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        BillingMeterCollectionInner model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"location\":\"qwxrjfeallnw\",\"properties\":{\"category\":\"isnjampmngnz\",\"meterType\":\"xaqwoochcbonqv\",\"displayName\":\"vlrxnjeaseiph\"},\"id\":\"f\",\"name\":\"okeyyienj\",\"type\":\"dlwtgrhpdj\"},{\"location\":\"umasxazjpq\",\"properties\":{\"category\":\"ualhbxxhejj\",\"meterType\":\"v\",\"displayName\":\"dgwdslfhot\"},\"id\":\"cynpwlbjnp\",\"name\":\"acfta\",\"type\":\"ehxnltyfsop\"}]}")
                .toObject(BillingMeterCollectionInner.class);
        Assertions.assertEquals("qwxrjfeallnw", model.value().get(0).location());
        Assertions.assertEquals("isnjampmngnz", model.value().get(0).properties().category());
        Assertions.assertEquals("xaqwoochcbonqv", model.value().get(0).properties().meterType());
        Assertions.assertEquals("vlrxnjeaseiph", model.value().get(0).properties().displayName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        BillingMeterCollectionInner model =
            new BillingMeterCollectionInner()
                .withValue(
                    Arrays
                        .asList(
                            new BillingMeter()
                                .withLocation("qwxrjfeallnw")
                                .withProperties(
                                    new BillingMeterProperties()
                                        .withCategory("isnjampmngnz")
                                        .withMeterType("xaqwoochcbonqv")
                                        .withDisplayName("vlrxnjeaseiph")),
                            new BillingMeter()
                                .withLocation("umasxazjpq")
                                .withProperties(
                                    new BillingMeterProperties()
                                        .withCategory("ualhbxxhejj")
                                        .withMeterType("v")
                                        .withDisplayName("dgwdslfhot"))));
        model = BinaryData.fromObject(model).toObject(BillingMeterCollectionInner.class);
        Assertions.assertEquals("qwxrjfeallnw", model.value().get(0).location());
        Assertions.assertEquals("isnjampmngnz", model.value().get(0).properties().category());
        Assertions.assertEquals("xaqwoochcbonqv", model.value().get(0).properties().meterType());
        Assertions.assertEquals("vlrxnjeaseiph", model.value().get(0).properties().displayName());
    }
}
