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

package com.azure.resourcemanager.mediaservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mediaservices.models.FilterTrackPropertyCompareOperation;
import com.azure.resourcemanager.mediaservices.models.FilterTrackPropertyCondition;
import com.azure.resourcemanager.mediaservices.models.FilterTrackPropertyType;
import com.azure.resourcemanager.mediaservices.models.FilterTrackSelection;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class FilterTrackSelectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        FilterTrackSelection model =
            BinaryData
                .fromString(
                    "{\"trackSelections\":[{\"property\":\"Language\",\"value\":\"flusarhmof\",\"operation\":\"NotEqual\"}]}")
                .toObject(FilterTrackSelection.class);
        Assertions.assertEquals(FilterTrackPropertyType.LANGUAGE, model.trackSelections().get(0).property());
        Assertions.assertEquals("flusarhmof", model.trackSelections().get(0).value());
        Assertions
            .assertEquals(FilterTrackPropertyCompareOperation.NOT_EQUAL, model.trackSelections().get(0).operation());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        FilterTrackSelection model =
            new FilterTrackSelection()
                .withTrackSelections(
                    Arrays
                        .asList(
                            new FilterTrackPropertyCondition()
                                .withProperty(FilterTrackPropertyType.LANGUAGE)
                                .withValue("flusarhmof")
                                .withOperation(FilterTrackPropertyCompareOperation.NOT_EQUAL)));
        model = BinaryData.fromObject(model).toObject(FilterTrackSelection.class);
        Assertions.assertEquals(FilterTrackPropertyType.LANGUAGE, model.trackSelections().get(0).property());
        Assertions.assertEquals("flusarhmof", model.trackSelections().get(0).value());
        Assertions
            .assertEquals(FilterTrackPropertyCompareOperation.NOT_EQUAL, model.trackSelections().get(0).operation());
    }
}
