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

package com.azure.resourcemanager.avs.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkSegmentProperties;
import com.azure.resourcemanager.avs.models.WorkloadNetworkSegmentSubnet;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class WorkloadNetworkSegmentPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        WorkloadNetworkSegmentProperties model =
            BinaryData
                .fromString(
                    "{\"displayName\":\"ashsfwxos\",\"connectedGateway\":\"z\",\"subnet\":{\"dhcpRanges\":[\"i\",\"jooxdjebw\",\"ucww\"],\"gatewayAddress\":\"ovbvmeueciv\"},\"portVif\":[{\"portName\":\"euojgjrwju\"},{\"portName\":\"otwmcdyt\"},{\"portName\":\"wit\"}],\"status\":\"SUCCESS\",\"provisioningState\":\"Failed\",\"revision\":7022663417329031305}")
                .toObject(WorkloadNetworkSegmentProperties.class);
        Assertions.assertEquals("ashsfwxos", model.displayName());
        Assertions.assertEquals("z", model.connectedGateway());
        Assertions.assertEquals("i", model.subnet().dhcpRanges().get(0));
        Assertions.assertEquals("ovbvmeueciv", model.subnet().gatewayAddress());
        Assertions.assertEquals(7022663417329031305L, model.revision());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        WorkloadNetworkSegmentProperties model =
            new WorkloadNetworkSegmentProperties()
                .withDisplayName("ashsfwxos")
                .withConnectedGateway("z")
                .withSubnet(
                    new WorkloadNetworkSegmentSubnet()
                        .withDhcpRanges(Arrays.asList("i", "jooxdjebw", "ucww"))
                        .withGatewayAddress("ovbvmeueciv"))
                .withRevision(7022663417329031305L);
        model = BinaryData.fromObject(model).toObject(WorkloadNetworkSegmentProperties.class);
        Assertions.assertEquals("ashsfwxos", model.displayName());
        Assertions.assertEquals("z", model.connectedGateway());
        Assertions.assertEquals("i", model.subnet().dhcpRanges().get(0));
        Assertions.assertEquals("ovbvmeueciv", model.subnet().gatewayAddress());
        Assertions.assertEquals(7022663417329031305L, model.revision());
    }
}
