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

package com.azure.resourcemanager.cosmosdbforpostgresql.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.FirewallRuleInner;
import com.azure.resourcemanager.cosmosdbforpostgresql.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\":\"dntwndeicbtw\",\"endIpAddress\":\"pzaoqvuhr\",\"provisioningState\":\"Succeeded\"},\"id\":\"cyddglmjthjqk\",\"name\":\"pyeicxm\",\"type\":\"ciwqvhk\"},{\"properties\":{\"startIpAddress\":\"ixuigdtopbobj\",\"endIpAddress\":\"ghmewuam\",\"provisioningState\":\"Failed\"},\"id\":\"z\",\"name\":\"yvvtpgvdfgio\",\"type\":\"kftutqxlngxlefg\"},{\"properties\":{\"startIpAddress\":\"gnxkrxdqmidtth\",\"endIpAddress\":\"rvqdra\",\"provisioningState\":\"Canceled\"},\"id\":\"big\",\"name\":\"h\",\"type\":\"qfbow\"}]}")
                .toObject(FirewallRuleListResult.class);
        Assertions.assertEquals("dntwndeicbtw", model.value().get(0).startIpAddress());
        Assertions.assertEquals("pzaoqvuhr", model.value().get(0).endIpAddress());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        FirewallRuleListResult model =
            new FirewallRuleListResult()
                .withValue(
                    Arrays
                        .asList(
                            new FirewallRuleInner().withStartIpAddress("dntwndeicbtw").withEndIpAddress("pzaoqvuhr"),
                            new FirewallRuleInner().withStartIpAddress("ixuigdtopbobj").withEndIpAddress("ghmewuam"),
                            new FirewallRuleInner().withStartIpAddress("gnxkrxdqmidtth").withEndIpAddress("rvqdra")));
        model = BinaryData.fromObject(model).toObject(FirewallRuleListResult.class);
        Assertions.assertEquals("dntwndeicbtw", model.value().get(0).startIpAddress());
        Assertions.assertEquals("pzaoqvuhr", model.value().get(0).endIpAddress());
    }
}
