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

public final class JitNetworkAccessPolicyInitiateRequestTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        JitNetworkAccessPolicyInitiateRequest model =
            BinaryData
                .fromString(
                    "{\"virtualMachines\":[{\"id\":\"trsqqw\",\"ports\":[]}],\"justification\":\"mwqkchcxwaxf\"}")
                .toObject(JitNetworkAccessPolicyInitiateRequest.class);
        Assertions.assertEquals("trsqqw", model.virtualMachines().get(0).id());
        Assertions.assertEquals("mwqkchcxwaxf", model.justification());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        JitNetworkAccessPolicyInitiateRequest model =
            new JitNetworkAccessPolicyInitiateRequest()
                .withVirtualMachines(
                    Arrays
                        .asList(
                            new JitNetworkAccessPolicyInitiateVirtualMachine()
                                .withId("trsqqw")
                                .withPorts(Arrays.asList())))
                .withJustification("mwqkchcxwaxf");
        model = BinaryData.fromObject(model).toObject(JitNetworkAccessPolicyInitiateRequest.class);
        Assertions.assertEquals("trsqqw", model.virtualMachines().get(0).id());
        Assertions.assertEquals("mwqkchcxwaxf", model.justification());
    }
}
