// 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.FirewallRuleInner;
import com.azure.resourcemanager.postgresqlflexibleserver.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\":\"nvowgujju\",\"endIpAddress\":\"wdkcglhsl\"},\"id\":\"jdyggdtji\",\"name\":\"hbkuofqwey\",\"type\":\"hmenevfyexfwhybc\"},{\"properties\":{\"startIpAddress\":\"bvyvdcsity\",\"endIpAddress\":\"naamde\"},\"id\":\"eh\",\"name\":\"iqscjeypv\",\"type\":\"ezrkgqhcjrefo\"}],\"nextLink\":\"mkqsleyyv\"}")
                .toObject(FirewallRuleListResult.class);
        Assertions.assertEquals("nvowgujju", model.value().get(0).startIpAddress());
        Assertions.assertEquals("wdkcglhsl", model.value().get(0).endIpAddress());
        Assertions.assertEquals("mkqsleyyv", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        FirewallRuleListResult model =
            new FirewallRuleListResult()
                .withValue(
                    Arrays
                        .asList(
                            new FirewallRuleInner().withStartIpAddress("nvowgujju").withEndIpAddress("wdkcglhsl"),
                            new FirewallRuleInner().withStartIpAddress("bvyvdcsity").withEndIpAddress("naamde")))
                .withNextLink("mkqsleyyv");
        model = BinaryData.fromObject(model).toObject(FirewallRuleListResult.class);
        Assertions.assertEquals("nvowgujju", model.value().get(0).startIpAddress());
        Assertions.assertEquals("wdkcglhsl", model.value().get(0).endIpAddress());
        Assertions.assertEquals("mkqsleyyv", model.nextLink());
    }
}
