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

package com.azure.resourcemanager.dnsresolver.generated;

import com.azure.core.management.SubResource;
import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.dnsresolver.models.IpAllocationMethod;
import com.azure.resourcemanager.dnsresolver.models.IpConfiguration;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class IpConfigurationTests {
    @Test
    public void testDeserialize() {
        IpConfiguration model =
            BinaryData
                .fromString(
                    "{\"subnet\":{\"id\":\"czwlokjyem\"},\"privateIpAddress\":\"vnipjox\",\"privateIpAllocationMethod\":\"Static\"}")
                .toObject(IpConfiguration.class);
        Assertions.assertEquals("czwlokjyem", model.subnet().id());
        Assertions.assertEquals("vnipjox", model.privateIpAddress());
        Assertions.assertEquals(IpAllocationMethod.STATIC, model.privateIpAllocationMethod());
    }

    @Test
    public void testSerialize() {
        IpConfiguration model =
            new IpConfiguration()
                .withSubnet(new SubResource().withId("czwlokjyem"))
                .withPrivateIpAddress("vnipjox")
                .withPrivateIpAllocationMethod(IpAllocationMethod.STATIC);
        model = BinaryData.fromObject(model).toObject(IpConfiguration.class);
        Assertions.assertEquals("czwlokjyem", model.subnet().id());
        Assertions.assertEquals("vnipjox", model.privateIpAddress());
        Assertions.assertEquals(IpAllocationMethod.STATIC, model.privateIpAllocationMethod());
    }
}
