// 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.AddressSpace;
import com.azure.resourcemanager.databricks.models.VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork;
import com.azure.resourcemanager.databricks.models.VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class VirtualNetworkPeeringInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        VirtualNetworkPeeringInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"allowVirtualNetworkAccess\":false,\"allowForwardedTraffic\":true,\"allowGatewayTransit\":false,\"useRemoteGateways\":false,\"databricksVirtualNetwork\":{\"id\":\"uokktwhrdxwz\"},\"databricksAddressSpace\":{\"addressPrefixes\":[\"mbsureximo\"]},\"remoteVirtualNetwork\":{\"id\":\"ocfs\"},\"remoteAddressSpace\":{\"addressPrefixes\":[\"mddystkiiux\",\"qyud\"]},\"peeringState\":\"Disconnected\",\"provisioningState\":\"Succeeded\"},\"id\":\"nbpoczvyifqrvkdv\",\"name\":\"sllr\",\"type\":\"vvdfwatkpnpul\"}")
                .toObject(VirtualNetworkPeeringInner.class);
        Assertions.assertEquals(false, model.allowVirtualNetworkAccess());
        Assertions.assertEquals(true, model.allowForwardedTraffic());
        Assertions.assertEquals(false, model.allowGatewayTransit());
        Assertions.assertEquals(false, model.useRemoteGateways());
        Assertions.assertEquals("uokktwhrdxwz", model.databricksVirtualNetwork().id());
        Assertions.assertEquals("mbsureximo", model.databricksAddressSpace().addressPrefixes().get(0));
        Assertions.assertEquals("ocfs", model.remoteVirtualNetwork().id());
        Assertions.assertEquals("mddystkiiux", model.remoteAddressSpace().addressPrefixes().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        VirtualNetworkPeeringInner model =
            new VirtualNetworkPeeringInner()
                .withAllowVirtualNetworkAccess(false)
                .withAllowForwardedTraffic(true)
                .withAllowGatewayTransit(false)
                .withUseRemoteGateways(false)
                .withDatabricksVirtualNetwork(
                    new VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork().withId("uokktwhrdxwz"))
                .withDatabricksAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("mbsureximo")))
                .withRemoteVirtualNetwork(
                    new VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork().withId("ocfs"))
                .withRemoteAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("mddystkiiux", "qyud")));
        model = BinaryData.fromObject(model).toObject(VirtualNetworkPeeringInner.class);
        Assertions.assertEquals(false, model.allowVirtualNetworkAccess());
        Assertions.assertEquals(true, model.allowForwardedTraffic());
        Assertions.assertEquals(false, model.allowGatewayTransit());
        Assertions.assertEquals(false, model.useRemoteGateways());
        Assertions.assertEquals("uokktwhrdxwz", model.databricksVirtualNetwork().id());
        Assertions.assertEquals("mbsureximo", model.databricksAddressSpace().addressPrefixes().get(0));
        Assertions.assertEquals("ocfs", model.remoteVirtualNetwork().id());
        Assertions.assertEquals("mddystkiiux", model.remoteAddressSpace().addressPrefixes().get(0));
    }
}
