// 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.models.AffinityStrength;
import com.azure.resourcemanager.avs.models.AffinityType;
import com.azure.resourcemanager.avs.models.AzureHybridBenefitType;
import com.azure.resourcemanager.avs.models.PlacementPolicyState;
import com.azure.resourcemanager.avs.models.VmHostPlacementPolicyProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class VmHostPlacementPolicyPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        VmHostPlacementPolicyProperties model =
            BinaryData
                .fromString(
                    "{\"type\":\"VmHost\",\"vmMembers\":[\"ffukiscvw\"],\"hostMembers\":[\"hwplefaxvx\",\"l\",\"btgn\",\"nzeyqxtjj\"],\"affinityType\":\"Affinity\",\"affinityStrength\":\"Should\",\"azureHybridBenefitType\":\"SqlHost\",\"state\":\"Disabled\",\"displayName\":\"vodggxdbee\",\"provisioningState\":\"Building\"}")
                .toObject(VmHostPlacementPolicyProperties.class);
        Assertions.assertEquals(PlacementPolicyState.DISABLED, model.state());
        Assertions.assertEquals("vodggxdbee", model.displayName());
        Assertions.assertEquals("ffukiscvw", model.vmMembers().get(0));
        Assertions.assertEquals("hwplefaxvx", model.hostMembers().get(0));
        Assertions.assertEquals(AffinityType.AFFINITY, model.affinityType());
        Assertions.assertEquals(AffinityStrength.SHOULD, model.affinityStrength());
        Assertions.assertEquals(AzureHybridBenefitType.SQL_HOST, model.azureHybridBenefitType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        VmHostPlacementPolicyProperties model =
            new VmHostPlacementPolicyProperties()
                .withState(PlacementPolicyState.DISABLED)
                .withDisplayName("vodggxdbee")
                .withVmMembers(Arrays.asList("ffukiscvw"))
                .withHostMembers(Arrays.asList("hwplefaxvx", "l", "btgn", "nzeyqxtjj"))
                .withAffinityType(AffinityType.AFFINITY)
                .withAffinityStrength(AffinityStrength.SHOULD)
                .withAzureHybridBenefitType(AzureHybridBenefitType.SQL_HOST);
        model = BinaryData.fromObject(model).toObject(VmHostPlacementPolicyProperties.class);
        Assertions.assertEquals(PlacementPolicyState.DISABLED, model.state());
        Assertions.assertEquals("vodggxdbee", model.displayName());
        Assertions.assertEquals("ffukiscvw", model.vmMembers().get(0));
        Assertions.assertEquals("hwplefaxvx", model.hostMembers().get(0));
        Assertions.assertEquals(AffinityType.AFFINITY, model.affinityType());
        Assertions.assertEquals(AffinityStrength.SHOULD, model.affinityStrength());
        Assertions.assertEquals(AzureHybridBenefitType.SQL_HOST, model.azureHybridBenefitType());
    }
}
