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

package com.azure.resourcemanager.mysqlflexibleserver.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.FirewallRuleInner;
import com.azure.resourcemanager.mysqlflexibleserver.models.FirewallRuleListResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class FirewallRuleListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        FirewallRuleListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"startIpAddress\":\"idtqajzyu\",\"endIpAddress\":\"pku\"},\"id\":\"krlkhbzhfepg\",\"name\":\"gqexzlocxs\",\"type\":\"paierh\"},{\"properties\":{\"startIpAddress\":\"bcsglumma\",\"endIpAddress\":\"tjaodxobnb\"},\"id\":\"k\",\"name\":\"pxokajionp\",\"type\":\"mexgstxgcp\"},{\"properties\":{\"startIpAddress\":\"dg\",\"endIpAddress\":\"aajrm\"},\"id\":\"jwzrl\",\"name\":\"vmclw\",\"type\":\"ijcoejctb\"}],\"nextLink\":\"qsqsy\"}")
                .toObject(FirewallRuleListResult.class);
        Assertions.assertEquals("idtqajzyu", model.value().get(0).startIpAddress());
        Assertions.assertEquals("pku", model.value().get(0).endIpAddress());
        Assertions.assertEquals("qsqsy", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        FirewallRuleListResult model =
            new FirewallRuleListResult()
                .withValue(
                    Arrays
                        .asList(
                            new FirewallRuleInner().withStartIpAddress("idtqajzyu").withEndIpAddress("pku"),
                            new FirewallRuleInner().withStartIpAddress("bcsglumma").withEndIpAddress("tjaodxobnb"),
                            new FirewallRuleInner().withStartIpAddress("dg").withEndIpAddress("aajrm")))
                .withNextLink("qsqsy");
        model = BinaryData.fromObject(model).toObject(FirewallRuleListResult.class);
        Assertions.assertEquals("idtqajzyu", model.value().get(0).startIpAddress());
        Assertions.assertEquals("pku", model.value().get(0).endIpAddress());
        Assertions.assertEquals("qsqsy", model.nextLink());
    }
}
