// 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.TriggerInner;
import com.azure.resourcemanager.imagebuilder.models.TriggerCollection;
import com.azure.resourcemanager.imagebuilder.models.TriggerProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class TriggerCollectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        TriggerCollection model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"kind\":\"TriggerProperties\",\"provisioningState\":\"Failed\"},\"id\":\"jdkirsoodqx\",\"name\":\"crmnohjtckwhds\",\"type\":\"ifiyipjxsqwpgrj\"},{\"properties\":{\"kind\":\"TriggerProperties\",\"provisioningState\":\"Creating\"},\"id\":\"jxvsnbyxqabn\",\"name\":\"ocpcy\",\"type\":\"hurzafblj\"},{\"properties\":{\"kind\":\"TriggerProperties\",\"provisioningState\":\"Canceled\"},\"id\":\"qcjm\",\"name\":\"ljavbqid\",\"type\":\"qajzyulpkudjkr\"},{\"properties\":{\"kind\":\"TriggerProperties\",\"provisioningState\":\"Updating\"},\"id\":\"fepgzgq\",\"name\":\"xzlocxscp\",\"type\":\"ierhhbcsglummaj\"}],\"nextLink\":\"aodxo\"}")
                .toObject(TriggerCollection.class);
        Assertions.assertEquals("aodxo", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        TriggerCollection model =
            new TriggerCollection()
                .withValue(
                    Arrays
                        .asList(
                            new TriggerInner().withProperties(new TriggerProperties()),
                            new TriggerInner().withProperties(new TriggerProperties()),
                            new TriggerInner().withProperties(new TriggerProperties()),
                            new TriggerInner().withProperties(new TriggerProperties())))
                .withNextLink("aodxo");
        model = BinaryData.fromObject(model).toObject(TriggerCollection.class);
        Assertions.assertEquals("aodxo", model.nextLink());
    }
}
