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

package com.azure.resourcemanager.recoveryservicesbackup.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.recoveryservicesbackup.models.ClientScriptForConnect;
import com.azure.resourcemanager.recoveryservicesbackup.models.InstantItemRecoveryTarget;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class InstantItemRecoveryTargetTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        InstantItemRecoveryTarget model =
            BinaryData
                .fromString(
                    "{\"clientScripts\":[{\"scriptContent\":\"c\",\"scriptExtension\":\"tasfaymxbulpzeal\",\"osType\":\"qkyojwyvf\",\"url\":\"btsuahxs\",\"scriptNameSuffix\":\"jcmmzrrscub\"},{\"scriptContent\":\"sd\",\"scriptExtension\":\"pxqwo\",\"osType\":\"ffjxcjrmmuabwib\",\"url\":\"ogjo\",\"scriptNameSuffix\":\"cyefoyzbamwine\"}]}")
                .toObject(InstantItemRecoveryTarget.class);
        Assertions.assertEquals("c", model.clientScripts().get(0).scriptContent());
        Assertions.assertEquals("tasfaymxbulpzeal", model.clientScripts().get(0).scriptExtension());
        Assertions.assertEquals("qkyojwyvf", model.clientScripts().get(0).osType());
        Assertions.assertEquals("btsuahxs", model.clientScripts().get(0).url());
        Assertions.assertEquals("jcmmzrrscub", model.clientScripts().get(0).scriptNameSuffix());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        InstantItemRecoveryTarget model =
            new InstantItemRecoveryTarget()
                .withClientScripts(
                    Arrays
                        .asList(
                            new ClientScriptForConnect()
                                .withScriptContent("c")
                                .withScriptExtension("tasfaymxbulpzeal")
                                .withOsType("qkyojwyvf")
                                .withUrl("btsuahxs")
                                .withScriptNameSuffix("jcmmzrrscub"),
                            new ClientScriptForConnect()
                                .withScriptContent("sd")
                                .withScriptExtension("pxqwo")
                                .withOsType("ffjxcjrmmuabwib")
                                .withUrl("ogjo")
                                .withScriptNameSuffix("cyefoyzbamwine")));
        model = BinaryData.fromObject(model).toObject(InstantItemRecoveryTarget.class);
        Assertions.assertEquals("c", model.clientScripts().get(0).scriptContent());
        Assertions.assertEquals("tasfaymxbulpzeal", model.clientScripts().get(0).scriptExtension());
        Assertions.assertEquals("qkyojwyvf", model.clientScripts().get(0).osType());
        Assertions.assertEquals("btsuahxs", model.clientScripts().get(0).url());
        Assertions.assertEquals("jcmmzrrscub", model.clientScripts().get(0).scriptNameSuffix());
    }
}
