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

package com.azure.resourcemanager.paloaltonetworks.ngfw.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.AdvSecurityObjectModel;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.NameDescriptionObject;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AdvSecurityObjectModelTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AdvSecurityObjectModel model =
            BinaryData
                .fromString(
                    "{\"type\":\"qsc\",\"entry\":[{\"name\":\"ypvhezrkg\",\"description\":\"c\"},{\"name\":\"refovgmkqsleyyvx\",\"description\":\"jpkcattpng\"},{\"name\":\"cr\",\"description\":\"zsqpjhvmdajvny\"}]}")
                .toObject(AdvSecurityObjectModel.class);
        Assertions.assertEquals("qsc", model.type());
        Assertions.assertEquals("ypvhezrkg", model.entry().get(0).name());
        Assertions.assertEquals("c", model.entry().get(0).description());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AdvSecurityObjectModel model =
            new AdvSecurityObjectModel()
                .withType("qsc")
                .withEntry(
                    Arrays
                        .asList(
                            new NameDescriptionObject().withName("ypvhezrkg").withDescription("c"),
                            new NameDescriptionObject().withName("refovgmkqsleyyvx").withDescription("jpkcattpng"),
                            new NameDescriptionObject().withName("cr").withDescription("zsqpjhvmdajvny")));
        model = BinaryData.fromObject(model).toObject(AdvSecurityObjectModel.class);
        Assertions.assertEquals("qsc", model.type());
        Assertions.assertEquals("ypvhezrkg", model.entry().get(0).name());
        Assertions.assertEquals("c", model.entry().get(0).description());
    }
}
