// 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.AdditionalWorkspaceDataType;
import com.azure.resourcemanager.security.models.AdditionalWorkspaceType;
import com.azure.resourcemanager.security.models.AdditionalWorkspacesProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AdditionalWorkspacesPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AdditionalWorkspacesProperties model =
            BinaryData
                .fromString("{\"workspace\":\"yq\",\"type\":\"Sentinel\",\"dataTypes\":[\"Alerts\",\"RawEvents\"]}")
                .toObject(AdditionalWorkspacesProperties.class);
        Assertions.assertEquals("yq", model.workspace());
        Assertions.assertEquals(AdditionalWorkspaceType.SENTINEL, model.type());
        Assertions.assertEquals(AdditionalWorkspaceDataType.ALERTS, model.dataTypes().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AdditionalWorkspacesProperties model =
            new AdditionalWorkspacesProperties()
                .withWorkspace("yq")
                .withType(AdditionalWorkspaceType.SENTINEL)
                .withDataTypes(
                    Arrays.asList(AdditionalWorkspaceDataType.ALERTS, AdditionalWorkspaceDataType.RAW_EVENTS));
        model = BinaryData.fromObject(model).toObject(AdditionalWorkspacesProperties.class);
        Assertions.assertEquals("yq", model.workspace());
        Assertions.assertEquals(AdditionalWorkspaceType.SENTINEL, model.type());
        Assertions.assertEquals(AdditionalWorkspaceDataType.ALERTS, model.dataTypes().get(0));
    }
}
