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

package com.azure.resourcemanager.hdinsight.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hdinsight.fluent.models.IpConfigurationProperties;
import com.azure.resourcemanager.hdinsight.models.PrivateIpAllocationMethod;
import com.azure.resourcemanager.hdinsight.models.ResourceId;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class IpConfigurationPropertiesTests {
    @Test
    public void testDeserialize() {
        IpConfigurationProperties model =
            BinaryData
                .fromString(
                    "{\"provisioningState\":\"Deleting\",\"primary\":true,\"privateIPAddress\":\"cxmqciwqvhkhix\",\"privateIPAllocationMethod\":\"static\",\"subnet\":{\"id\":\"opbobj\"}}")
                .toObject(IpConfigurationProperties.class);
        Assertions.assertEquals(true, model.primary());
        Assertions.assertEquals("cxmqciwqvhkhix", model.privateIpAddress());
        Assertions.assertEquals(PrivateIpAllocationMethod.STATIC, model.privateIpAllocationMethod());
        Assertions.assertEquals("opbobj", model.subnet().id());
    }

    @Test
    public void testSerialize() {
        IpConfigurationProperties model =
            new IpConfigurationProperties()
                .withPrimary(true)
                .withPrivateIpAddress("cxmqciwqvhkhix")
                .withPrivateIpAllocationMethod(PrivateIpAllocationMethod.STATIC)
                .withSubnet(new ResourceId().withId("opbobj"));
        model = BinaryData.fromObject(model).toObject(IpConfigurationProperties.class);
        Assertions.assertEquals(true, model.primary());
        Assertions.assertEquals("cxmqciwqvhkhix", model.privateIpAddress());
        Assertions.assertEquals(PrivateIpAllocationMethod.STATIC, model.privateIpAllocationMethod());
        Assertions.assertEquals("opbobj", model.subnet().id());
    }
}
