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

package com.azure.resourcemanager.paloaltonetworks.ngfw.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.IpAddress;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.IpAddressSpace;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.VnetConfiguration;
import org.junit.jupiter.api.Assertions;

public final class VnetConfigurationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        VnetConfiguration model =
            BinaryData
                .fromString(
                    "{\"vnet\":{\"resourceId\":\"swhccsphk\",\"addressSpace\":\"vwitqscyw\"},\"trustSubnet\":{\"resourceId\":\"gwol\",\"addressSpace\":\"czbwemhairsbr\"},\"unTrustSubnet\":{\"resourceId\":\"dwmsweypqwd\",\"addressSpace\":\"gicccnxqhuex\"},\"ipOfTrustSubnetForUdr\":{\"resourceId\":\"tlstvlzywem\",\"address\":\"rncsdtclu\"}}")
                .toObject(VnetConfiguration.class);
        Assertions.assertEquals("swhccsphk", model.vnet().resourceId());
        Assertions.assertEquals("vwitqscyw", model.vnet().addressSpace());
        Assertions.assertEquals("gwol", model.trustSubnet().resourceId());
        Assertions.assertEquals("czbwemhairsbr", model.trustSubnet().addressSpace());
        Assertions.assertEquals("dwmsweypqwd", model.unTrustSubnet().resourceId());
        Assertions.assertEquals("gicccnxqhuex", model.unTrustSubnet().addressSpace());
        Assertions.assertEquals("tlstvlzywem", model.ipOfTrustSubnetForUdr().resourceId());
        Assertions.assertEquals("rncsdtclu", model.ipOfTrustSubnetForUdr().address());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        VnetConfiguration model =
            new VnetConfiguration()
                .withVnet(new IpAddressSpace().withResourceId("swhccsphk").withAddressSpace("vwitqscyw"))
                .withTrustSubnet(new IpAddressSpace().withResourceId("gwol").withAddressSpace("czbwemhairsbr"))
                .withUnTrustSubnet(new IpAddressSpace().withResourceId("dwmsweypqwd").withAddressSpace("gicccnxqhuex"))
                .withIpOfTrustSubnetForUdr(new IpAddress().withResourceId("tlstvlzywem").withAddress("rncsdtclu"));
        model = BinaryData.fromObject(model).toObject(VnetConfiguration.class);
        Assertions.assertEquals("swhccsphk", model.vnet().resourceId());
        Assertions.assertEquals("vwitqscyw", model.vnet().addressSpace());
        Assertions.assertEquals("gwol", model.trustSubnet().resourceId());
        Assertions.assertEquals("czbwemhairsbr", model.trustSubnet().addressSpace());
        Assertions.assertEquals("dwmsweypqwd", model.unTrustSubnet().resourceId());
        Assertions.assertEquals("gicccnxqhuex", model.unTrustSubnet().addressSpace());
        Assertions.assertEquals("tlstvlzywem", model.ipOfTrustSubnetForUdr().resourceId());
        Assertions.assertEquals("rncsdtclu", model.ipOfTrustSubnetForUdr().address());
    }
}
