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

package com.azure.resourcemanager.deploymentmanager.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.deploymentmanager.fluent.models.RolloutRequestProperties;
import com.azure.resourcemanager.deploymentmanager.models.StepGroup;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class RolloutRequestPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        RolloutRequestProperties model =
            BinaryData
                .fromString(
                    "{\"buildVersion\":\"bvmgxsabkyqduuji\",\"artifactSourceId\":\"jczdzevndh\",\"targetServiceTopologyId\":\"rwpdappdsbdkvwrw\",\"stepGroups\":[{\"name\":\"eusnhutj\",\"dependsOnStepGroups\":[\"mrldhu\",\"jzzd\",\"tqxhocdgeab\",\"gphuticndvka\"],\"preDeploymentSteps\":[],\"deploymentTargetId\":\"yiftyhxhuro\",\"postDeploymentSteps\":[]},{\"name\":\"yxolniwp\",\"dependsOnStepGroups\":[\"kjfkg\",\"awxklr\",\"plwckbas\",\"ypnddhsgcb\"],\"preDeploymentSteps\":[],\"deploymentTargetId\":\"hejkotynqgou\",\"postDeploymentSteps\":[]}]}")
                .toObject(RolloutRequestProperties.class);
        Assertions.assertEquals("bvmgxsabkyqduuji", model.buildVersion());
        Assertions.assertEquals("jczdzevndh", model.artifactSourceId());
        Assertions.assertEquals("rwpdappdsbdkvwrw", model.targetServiceTopologyId());
        Assertions.assertEquals("eusnhutj", model.stepGroups().get(0).name());
        Assertions.assertEquals("mrldhu", model.stepGroups().get(0).dependsOnStepGroups().get(0));
        Assertions.assertEquals("yiftyhxhuro", model.stepGroups().get(0).deploymentTargetId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        RolloutRequestProperties model =
            new RolloutRequestProperties()
                .withBuildVersion("bvmgxsabkyqduuji")
                .withArtifactSourceId("jczdzevndh")
                .withTargetServiceTopologyId("rwpdappdsbdkvwrw")
                .withStepGroups(
                    Arrays
                        .asList(
                            new StepGroup()
                                .withName("eusnhutj")
                                .withDependsOnStepGroups(Arrays.asList("mrldhu", "jzzd", "tqxhocdgeab", "gphuticndvka"))
                                .withPreDeploymentSteps(Arrays.asList())
                                .withDeploymentTargetId("yiftyhxhuro")
                                .withPostDeploymentSteps(Arrays.asList()),
                            new StepGroup()
                                .withName("yxolniwp")
                                .withDependsOnStepGroups(Arrays.asList("kjfkg", "awxklr", "plwckbas", "ypnddhsgcb"))
                                .withPreDeploymentSteps(Arrays.asList())
                                .withDeploymentTargetId("hejkotynqgou")
                                .withPostDeploymentSteps(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(RolloutRequestProperties.class);
        Assertions.assertEquals("bvmgxsabkyqduuji", model.buildVersion());
        Assertions.assertEquals("jczdzevndh", model.artifactSourceId());
        Assertions.assertEquals("rwpdappdsbdkvwrw", model.targetServiceTopologyId());
        Assertions.assertEquals("eusnhutj", model.stepGroups().get(0).name());
        Assertions.assertEquals("mrldhu", model.stepGroups().get(0).dependsOnStepGroups().get(0));
        Assertions.assertEquals("yiftyhxhuro", model.stepGroups().get(0).deploymentTargetId());
    }
}
