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

package com.azure.resourcemanager.imagebuilder.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.imagebuilder.fluent.models.RunOutputInner;
import com.azure.resourcemanager.imagebuilder.models.RunOutputCollection;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class RunOutputCollectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        RunOutputCollection model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"artifactId\":\"bbjfddgmbmbexp\",\"artifactUri\":\"htqqrolfp\",\"provisioningState\":\"Canceled\"},\"id\":\"lgbquxig\",\"name\":\"yjgzjaoyfhrtxiln\",\"type\":\"rkujy\"},{\"properties\":{\"artifactId\":\"eju\",\"artifactUri\":\"qawrlyxwj\",\"provisioningState\":\"Succeeded\"},\"id\":\"bnwbxgjvtbvpyssz\",\"name\":\"nruj\",\"type\":\"guhmuouqfpr\"},{\"properties\":{\"artifactId\":\"bngui\",\"artifactUri\":\"wu\",\"provisioningState\":\"Updating\"},\"id\":\"zxufiz\",\"name\":\"ckyfih\",\"type\":\"fidfvzw\"}],\"nextLink\":\"uht\"}")
                .toObject(RunOutputCollection.class);
        Assertions.assertEquals("bbjfddgmbmbexp", model.value().get(0).artifactId());
        Assertions.assertEquals("htqqrolfp", model.value().get(0).artifactUri());
        Assertions.assertEquals("uht", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        RunOutputCollection model =
            new RunOutputCollection()
                .withValue(
                    Arrays
                        .asList(
                            new RunOutputInner().withArtifactId("bbjfddgmbmbexp").withArtifactUri("htqqrolfp"),
                            new RunOutputInner().withArtifactId("eju").withArtifactUri("qawrlyxwj"),
                            new RunOutputInner().withArtifactId("bngui").withArtifactUri("wu")))
                .withNextLink("uht");
        model = BinaryData.fromObject(model).toObject(RunOutputCollection.class);
        Assertions.assertEquals("bbjfddgmbmbexp", model.value().get(0).artifactId());
        Assertions.assertEquals("htqqrolfp", model.value().get(0).artifactUri());
        Assertions.assertEquals("uht", model.nextLink());
    }
}
