// 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.models.IpConfiguration;
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 IpConfigurationTests {
    @Test
    public void testDeserialize() {
        IpConfiguration model =
            BinaryData
                .fromString(
                    "{\"id\":\"dtocj\",\"name\":\"xhvpmoue\",\"type\":\"dzxibqeojnxqbzvd\",\"properties\":{\"provisioningState\":\"InProgress\",\"primary\":true,\"privateIPAddress\":\"icbtwnpzao\",\"privateIPAllocationMethod\":\"static\",\"subnet\":{\"id\":\"hcffcyddglmjthjq\"}}}")
                .toObject(IpConfiguration.class);
        Assertions.assertEquals("xhvpmoue", model.name());
        Assertions.assertEquals(true, model.primary());
        Assertions.assertEquals("icbtwnpzao", model.privateIpAddress());
        Assertions.assertEquals(PrivateIpAllocationMethod.STATIC, model.privateIpAllocationMethod());
        Assertions.assertEquals("hcffcyddglmjthjq", model.subnet().id());
    }

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