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

package com.azure.resourcemanager.postgresqlflexibleserver.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.OperationListResultInner;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Operation;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationListResultInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationListResultInner model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"name\":\"begibtnmxiebwwa\",\"display\":{\"provider\":\"yqcgwrtzjuzgwy\",\"resource\":\"htxongmtsavjc\",\"operation\":\"wxqpsrknftguvri\",\"description\":\"prwmdyvxqt\"},\"isDataAction\":false,\"origin\":\"user\",\"properties\":{\"exrmcqibycnojvk\":\"dataoyq\"}},{\"name\":\"e\",\"display\":{\"provider\":\"gzva\",\"resource\":\"pjyzhpv\",\"operation\":\"zcjrvxdjzlmwlx\",\"description\":\"ug\"},\"isDataAction\":false,\"origin\":\"system\",\"properties\":{\"nxipeil\":\"datajvzunluthnnp\",\"dzumveekg\":\"datajzuaejxdultskzbb\",\"bsjyofdx\":\"datawozuhkf\"}},{\"name\":\"us\",\"display\":{\"provider\":\"ouwaboekqvkeln\",\"resource\":\"vbxwyjsflhh\",\"operation\":\"aln\",\"description\":\"xisxyawjoyaqcsl\"},\"isDataAction\":false,\"origin\":\"NotSpecified\",\"properties\":{\"lixhnrztfol\":\"datazyexzn\",\"dtpnapnyiropuhp\":\"databnxknalaulppg\",\"gqgitxmedjvcsl\":\"datagvpgy\"}},{\"name\":\"qwwncw\",\"display\":{\"provider\":\"xgk\",\"resource\":\"mgucna\",\"operation\":\"t\",\"description\":\"ellwptfdy\"},\"isDataAction\":true,\"origin\":\"NotSpecified\",\"properties\":{\"cq\":\"dataceopzfqrhhuaopp\"}}],\"nextLink\":\"xolzdahzx\"}")
                .toObject(OperationListResultInner.class);
        Assertions.assertEquals(false, model.value().get(0).isDataAction());
        Assertions.assertEquals("xolzdahzx", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationListResultInner model =
            new OperationListResultInner()
                .withValue(
                    Arrays
                        .asList(
                            new Operation().withIsDataAction(false),
                            new Operation().withIsDataAction(false),
                            new Operation().withIsDataAction(false),
                            new Operation().withIsDataAction(true)))
                .withNextLink("xolzdahzx");
        model = BinaryData.fromObject(model).toObject(OperationListResultInner.class);
        Assertions.assertEquals(false, model.value().get(0).isDataAction());
        Assertions.assertEquals("xolzdahzx", model.nextLink());
    }
}
