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

package com.azure.resourcemanager.resourcemover.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.resourcemover.models.Summary;
import com.azure.resourcemanager.resourcemover.models.SummaryCollection;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class SummaryCollectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SummaryCollection model =
            BinaryData
                .fromString("{\"fieldName\":\"x\",\"summary\":[{\"count\":1635783635,\"item\":\"dtocj\"}]}")
                .toObject(SummaryCollection.class);
        Assertions.assertEquals("x", model.fieldName());
        Assertions.assertEquals(1635783635, model.summary().get(0).count());
        Assertions.assertEquals("dtocj", model.summary().get(0).item());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SummaryCollection model =
            new SummaryCollection()
                .withFieldName("x")
                .withSummary(Arrays.asList(new Summary().withCount(1635783635).withItem("dtocj")));
        model = BinaryData.fromObject(model).toObject(SummaryCollection.class);
        Assertions.assertEquals("x", model.fieldName());
        Assertions.assertEquals(1635783635, model.summary().get(0).count());
        Assertions.assertEquals("dtocj", model.summary().get(0).item());
    }
}
