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

package com.azure.resourcemanager.security.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.security.models.AutomationRuleSet;
import com.azure.resourcemanager.security.models.AutomationSource;
import com.azure.resourcemanager.security.models.EventSource;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AutomationSourceTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AutomationSource model =
            BinaryData
                .fromString("{\"eventSource\":\"SubAssessmentsSnapshot\",\"ruleSets\":[{\"rules\":[]},{\"rules\":[]}]}")
                .toObject(AutomationSource.class);
        Assertions.assertEquals(EventSource.SUB_ASSESSMENTS_SNAPSHOT, model.eventSource());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AutomationSource model =
            new AutomationSource()
                .withEventSource(EventSource.SUB_ASSESSMENTS_SNAPSHOT)
                .withRuleSets(
                    Arrays
                        .asList(
                            new AutomationRuleSet().withRules(Arrays.asList()),
                            new AutomationRuleSet().withRules(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(AutomationSource.class);
        Assertions.assertEquals(EventSource.SUB_ASSESSMENTS_SNAPSHOT, model.eventSource());
    }
}
