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

package com.azure.resourcemanager.networkfunction.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.networkfunction.models.DestinationType;
import com.azure.resourcemanager.networkfunction.models.EmissionPoliciesPropertiesFormat;
import com.azure.resourcemanager.networkfunction.models.EmissionPolicyDestination;
import com.azure.resourcemanager.networkfunction.models.EmissionType;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class EmissionPoliciesPropertiesFormatTests {
    @Test
    public void testDeserialize() {
        EmissionPoliciesPropertiesFormat model =
            BinaryData
                .fromString(
                    "{\"emissionType\":\"IPFIX\",\"emissionDestinations\":[{\"destinationType\":\"AzureMonitor\"},{\"destinationType\":\"AzureMonitor\"}]}")
                .toObject(EmissionPoliciesPropertiesFormat.class);
        Assertions.assertEquals(EmissionType.IPFIX, model.emissionType());
        Assertions.assertEquals(DestinationType.AZURE_MONITOR, model.emissionDestinations().get(0).destinationType());
    }

    @Test
    public void testSerialize() {
        EmissionPoliciesPropertiesFormat model =
            new EmissionPoliciesPropertiesFormat()
                .withEmissionType(EmissionType.IPFIX)
                .withEmissionDestinations(
                    Arrays
                        .asList(
                            new EmissionPolicyDestination().withDestinationType(DestinationType.AZURE_MONITOR),
                            new EmissionPolicyDestination().withDestinationType(DestinationType.AZURE_MONITOR)));
        model = BinaryData.fromObject(model).toObject(EmissionPoliciesPropertiesFormat.class);
        Assertions.assertEquals(EmissionType.IPFIX, model.emissionType());
        Assertions.assertEquals(DestinationType.AZURE_MONITOR, model.emissionDestinations().get(0).destinationType());
    }
}
