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

package com.azure.resourcemanager.hdinsight.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hdinsight.fluent.models.RuntimeScriptActionDetailInner;
import com.azure.resourcemanager.hdinsight.models.ScriptActionsList;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class ScriptActionsListTests {
    @Test
    public void testDeserialize() {
        ScriptActionsList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"scriptExecutionId\":2717141106438874007,\"startTime\":\"rvqqaatj\",\"endTime\":\"rv\",\"status\":\"upmfiibfg\",\"operation\":\"ioolvrwxkvtkkgll\",\"executionSummary\":[],\"debugInformation\":\"gvjayvblmh\",\"name\":\"k\",\"uri\":\"uhbxvvy\",\"parameters\":\"s\",\"roles\":[\"byrqufeg\",\"uvwzfbnh\",\"mctlpdngitv\"],\"applicationName\":\"mhrixkwmyijejve\"},{\"scriptExecutionId\":5137218899058687714,\"startTime\":\"nai\",\"endTime\":\"xccbdreaxhcex\",\"status\":\"rvqahqkghtpwi\",\"operation\":\"hyjsvfycx\",\"executionSummary\":[],\"debugInformation\":\"oowvrv\",\"name\":\"t\",\"uri\":\"jqppyostronzmy\",\"parameters\":\"fipns\",\"roles\":[\"mcwaekrrjr\",\"afxtsgum\",\"jglikkxwslolb\",\"pvuzlmv\"],\"applicationName\":\"lfktgplcrpwjxe\"}],\"nextLink\":\"oi\"}")
                .toObject(ScriptActionsList.class);
        Assertions.assertEquals("k", model.value().get(0).name());
        Assertions.assertEquals("uhbxvvy", model.value().get(0).uri());
        Assertions.assertEquals("s", model.value().get(0).parameters());
        Assertions.assertEquals("byrqufeg", model.value().get(0).roles().get(0));
    }

    @Test
    public void testSerialize() {
        ScriptActionsList model =
            new ScriptActionsList()
                .withValue(
                    Arrays
                        .asList(
                            new RuntimeScriptActionDetailInner()
                                .withName("k")
                                .withUri("uhbxvvy")
                                .withParameters("s")
                                .withRoles(Arrays.asList("byrqufeg", "uvwzfbnh", "mctlpdngitv")),
                            new RuntimeScriptActionDetailInner()
                                .withName("t")
                                .withUri("jqppyostronzmy")
                                .withParameters("fipns")
                                .withRoles(Arrays.asList("mcwaekrrjr", "afxtsgum", "jglikkxwslolb", "pvuzlmv"))));
        model = BinaryData.fromObject(model).toObject(ScriptActionsList.class);
        Assertions.assertEquals("k", model.value().get(0).name());
        Assertions.assertEquals("uhbxvvy", model.value().get(0).uri());
        Assertions.assertEquals("s", model.value().get(0).parameters());
        Assertions.assertEquals("byrqufeg", model.value().get(0).roles().get(0));
    }
}
