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

package com.azure.resourcemanager.managednetworkfabric.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.managednetworkfabric.fluent.models.L3IsolationDomainPatchProperties;
import com.azure.resourcemanager.managednetworkfabric.models.AggregateRoute;
import com.azure.resourcemanager.managednetworkfabric.models.AggregateRouteConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy;
import com.azure.resourcemanager.managednetworkfabric.models.RedistributeConnectedSubnets;
import com.azure.resourcemanager.managednetworkfabric.models.RedistributeStaticRoutes;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class L3IsolationDomainPatchPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        L3IsolationDomainPatchProperties model =
            BinaryData
                .fromString(
                    "{\"redistributeConnectedSubnets\":\"False\",\"redistributeStaticRoutes\":\"False\",\"aggregateRouteConfiguration\":{\"ipv4Routes\":[{\"prefix\":\"dhtldwkyz\"},{\"prefix\":\"utknc\"}],\"ipv6Routes\":[{\"prefix\":\"svlxotogtwrup\"},{\"prefix\":\"xvnmicykvceov\"},{\"prefix\":\"lo\"}]},\"description\":\"oty\",\"connectedSubnetRoutePolicy\":{\"exportRoutePolicyId\":\"cnjbkcnxdhbt\",\"administrativeState\":\"Enabled\"}}")
                .toObject(L3IsolationDomainPatchProperties.class);
        Assertions.assertEquals(RedistributeConnectedSubnets.FALSE, model.redistributeConnectedSubnets());
        Assertions.assertEquals(RedistributeStaticRoutes.FALSE, model.redistributeStaticRoutes());
        Assertions.assertEquals("dhtldwkyz", model.aggregateRouteConfiguration().ipv4Routes().get(0).prefix());
        Assertions.assertEquals("svlxotogtwrup", model.aggregateRouteConfiguration().ipv6Routes().get(0).prefix());
        Assertions.assertEquals("oty", model.description());
        Assertions.assertEquals("cnjbkcnxdhbt", model.connectedSubnetRoutePolicy().exportRoutePolicyId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        L3IsolationDomainPatchProperties model =
            new L3IsolationDomainPatchProperties()
                .withRedistributeConnectedSubnets(RedistributeConnectedSubnets.FALSE)
                .withRedistributeStaticRoutes(RedistributeStaticRoutes.FALSE)
                .withAggregateRouteConfiguration(
                    new AggregateRouteConfiguration()
                        .withIpv4Routes(
                            Arrays
                                .asList(
                                    new AggregateRoute().withPrefix("dhtldwkyz"),
                                    new AggregateRoute().withPrefix("utknc")))
                        .withIpv6Routes(
                            Arrays
                                .asList(
                                    new AggregateRoute().withPrefix("svlxotogtwrup"),
                                    new AggregateRoute().withPrefix("xvnmicykvceov"),
                                    new AggregateRoute().withPrefix("lo"))))
                .withDescription("oty")
                .withConnectedSubnetRoutePolicy(
                    new L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy()
                        .withExportRoutePolicyId("cnjbkcnxdhbt"));
        model = BinaryData.fromObject(model).toObject(L3IsolationDomainPatchProperties.class);
        Assertions.assertEquals(RedistributeConnectedSubnets.FALSE, model.redistributeConnectedSubnets());
        Assertions.assertEquals(RedistributeStaticRoutes.FALSE, model.redistributeStaticRoutes());
        Assertions.assertEquals("dhtldwkyz", model.aggregateRouteConfiguration().ipv4Routes().get(0).prefix());
        Assertions.assertEquals("svlxotogtwrup", model.aggregateRouteConfiguration().ipv6Routes().get(0).prefix());
        Assertions.assertEquals("oty", model.description());
        Assertions.assertEquals("cnjbkcnxdhbt", model.connectedSubnetRoutePolicy().exportRoutePolicyId());
    }
}
