// 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.IngestionPolicyPropertiesFormat;
import com.azure.resourcemanager.networkfunction.models.IngestionSourcesPropertiesFormat;
import com.azure.resourcemanager.networkfunction.models.IngestionType;
import com.azure.resourcemanager.networkfunction.models.SourceType;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class IngestionPolicyPropertiesFormatTests {
    @Test
    public void testDeserialize() {
        IngestionPolicyPropertiesFormat model =
            BinaryData
                .fromString(
                    "{\"ingestionType\":\"IPFIX\",\"ingestionSources\":[{\"sourceType\":\"Resource\",\"resourceId\":\"ex\"},{\"sourceType\":\"Resource\",\"resourceId\":\"tq\"},{\"sourceType\":\"Resource\",\"resourceId\":\"fpfpsalgbquxigj\"}]}")
                .toObject(IngestionPolicyPropertiesFormat.class);
        Assertions.assertEquals(IngestionType.IPFIX, model.ingestionType());
        Assertions.assertEquals(SourceType.RESOURCE, model.ingestionSources().get(0).sourceType());
        Assertions.assertEquals("ex", model.ingestionSources().get(0).resourceId());
    }

    @Test
    public void testSerialize() {
        IngestionPolicyPropertiesFormat model =
            new IngestionPolicyPropertiesFormat()
                .withIngestionType(IngestionType.IPFIX)
                .withIngestionSources(
                    Arrays
                        .asList(
                            new IngestionSourcesPropertiesFormat()
                                .withSourceType(SourceType.RESOURCE)
                                .withResourceId("ex"),
                            new IngestionSourcesPropertiesFormat()
                                .withSourceType(SourceType.RESOURCE)
                                .withResourceId("tq"),
                            new IngestionSourcesPropertiesFormat()
                                .withSourceType(SourceType.RESOURCE)
                                .withResourceId("fpfpsalgbquxigj")));
        model = BinaryData.fromObject(model).toObject(IngestionPolicyPropertiesFormat.class);
        Assertions.assertEquals(IngestionType.IPFIX, model.ingestionType());
        Assertions.assertEquals(SourceType.RESOURCE, model.ingestionSources().get(0).sourceType());
        Assertions.assertEquals("ex", model.ingestionSources().get(0).resourceId());
    }
}
