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

package com.azure.resourcemanager.databricks.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.databricks.fluent.models.VirtualNetworkPeeringInner;
import com.azure.resourcemanager.databricks.models.VirtualNetworkPeeringList;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class VirtualNetworkPeeringListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        VirtualNetworkPeeringList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"allowVirtualNetworkAccess\":true,\"allowForwardedTraffic\":false,\"allowGatewayTransit\":false,\"useRemoteGateways\":true,\"peeringState\":\"Initiated\",\"provisioningState\":\"Succeeded\"},\"id\":\"ez\",\"name\":\"v\",\"type\":\"hxmzsbbzoggig\"},{\"properties\":{\"allowVirtualNetworkAccess\":true,\"allowForwardedTraffic\":false,\"allowGatewayTransit\":false,\"useRemoteGateways\":true,\"peeringState\":\"Disconnected\",\"provisioningState\":\"Deleting\"},\"id\":\"ptkoenkoukn\",\"name\":\"udwtiukbl\",\"type\":\"ngkpocipazy\"},{\"properties\":{\"allowVirtualNetworkAccess\":true,\"allowForwardedTraffic\":true,\"allowGatewayTransit\":false,\"useRemoteGateways\":true,\"peeringState\":\"Initiated\",\"provisioningState\":\"Updating\"},\"id\":\"evqzntypmrbp\",\"name\":\"zcdrqjsdpydnfyhx\",\"type\":\"eoejzic\"},{\"properties\":{\"allowVirtualNetworkAccess\":false,\"allowForwardedTraffic\":false,\"allowGatewayTransit\":true,\"useRemoteGateways\":true,\"peeringState\":\"Disconnected\",\"provisioningState\":\"Succeeded\"},\"id\":\"khaj\",\"name\":\"eyeam\",\"type\":\"p\"}],\"nextLink\":\"g\"}")
                .toObject(VirtualNetworkPeeringList.class);
        Assertions.assertEquals(true, model.value().get(0).allowVirtualNetworkAccess());
        Assertions.assertEquals(false, model.value().get(0).allowForwardedTraffic());
        Assertions.assertEquals(false, model.value().get(0).allowGatewayTransit());
        Assertions.assertEquals(true, model.value().get(0).useRemoteGateways());
        Assertions.assertEquals("g", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        VirtualNetworkPeeringList model =
            new VirtualNetworkPeeringList()
                .withValue(
                    Arrays
                        .asList(
                            new VirtualNetworkPeeringInner()
                                .withAllowVirtualNetworkAccess(true)
                                .withAllowForwardedTraffic(false)
                                .withAllowGatewayTransit(false)
                                .withUseRemoteGateways(true),
                            new VirtualNetworkPeeringInner()
                                .withAllowVirtualNetworkAccess(true)
                                .withAllowForwardedTraffic(false)
                                .withAllowGatewayTransit(false)
                                .withUseRemoteGateways(true),
                            new VirtualNetworkPeeringInner()
                                .withAllowVirtualNetworkAccess(true)
                                .withAllowForwardedTraffic(true)
                                .withAllowGatewayTransit(false)
                                .withUseRemoteGateways(true),
                            new VirtualNetworkPeeringInner()
                                .withAllowVirtualNetworkAccess(false)
                                .withAllowForwardedTraffic(false)
                                .withAllowGatewayTransit(true)
                                .withUseRemoteGateways(true)))
                .withNextLink("g");
        model = BinaryData.fromObject(model).toObject(VirtualNetworkPeeringList.class);
        Assertions.assertEquals(true, model.value().get(0).allowVirtualNetworkAccess());
        Assertions.assertEquals(false, model.value().get(0).allowForwardedTraffic());
        Assertions.assertEquals(false, model.value().get(0).allowGatewayTransit());
        Assertions.assertEquals(true, model.value().get(0).useRemoteGateways());
        Assertions.assertEquals("g", model.nextLink());
    }
}
