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

package com.azure.resourcemanager.hdinsight.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hdinsight.fluent.models.UsagesListResultInner;
import com.azure.resourcemanager.hdinsight.models.Usage;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class UsagesListResultInnerTests {
    @Test
    public void testDeserialize() {
        UsagesListResultInner model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"unit\":\"rvxaglrvimjwosy\",\"currentValue\":2401602492746642940,\"limit\":3589572009865624969,\"name\":{\"value\":\"k\",\"localizedValue\":\"umiekkezzi\"}},{\"unit\":\"ly\",\"currentValue\":8347972535078571246,\"limit\":3480662233344581257,\"name\":{\"value\":\"bdunygaeqid\",\"localizedValue\":\"fatpxllrxcyjmoa\"}}]}")
                .toObject(UsagesListResultInner.class);
        Assertions.assertEquals("rvxaglrvimjwosy", model.value().get(0).unit());
        Assertions.assertEquals(2401602492746642940L, model.value().get(0).currentValue());
        Assertions.assertEquals(3589572009865624969L, model.value().get(0).limit());
    }

    @Test
    public void testSerialize() {
        UsagesListResultInner model =
            new UsagesListResultInner()
                .withValue(
                    Arrays
                        .asList(
                            new Usage()
                                .withUnit("rvxaglrvimjwosy")
                                .withCurrentValue(2401602492746642940L)
                                .withLimit(3589572009865624969L),
                            new Usage()
                                .withUnit("ly")
                                .withCurrentValue(8347972535078571246L)
                                .withLimit(3480662233344581257L)));
        model = BinaryData.fromObject(model).toObject(UsagesListResultInner.class);
        Assertions.assertEquals("rvxaglrvimjwosy", model.value().get(0).unit());
        Assertions.assertEquals(2401602492746642940L, model.value().get(0).currentValue());
        Assertions.assertEquals(3589572009865624969L, model.value().get(0).limit());
    }
}
