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

package com.azure.resourcemanager.netapp.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.netapp.fluent.models.BackupInner;
import com.azure.resourcemanager.netapp.models.BackupsList;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class BackupsListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        BackupsList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"location\":\"twuoegrpkhjwni\",\"properties\":{\"backupId\":\"sluicpdggkzz\",\"creationDate\":\"2021-06-06T06:21:57Z\",\"provisioningState\":\"mpaxmodfvuefywsb\",\"size\":4032235244253302526,\"label\":\"yhrfouyftaakcpw\",\"backupType\":\"Scheduled\",\"failureReason\":\"qtmnubexkpzk\",\"volumeName\":\"ondjmq\",\"useExistingSnapshot\":true},\"id\":\"pomgkopkwhojvp\",\"name\":\"jqg\",\"type\":\"ysmocmbqfqvmkcxo\"}]}")
                .toObject(BackupsList.class);
        Assertions.assertEquals("twuoegrpkhjwni", model.value().get(0).location());
        Assertions.assertEquals("yhrfouyftaakcpw", model.value().get(0).label());
        Assertions.assertEquals(true, model.value().get(0).useExistingSnapshot());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        BackupsList model =
            new BackupsList()
                .withValue(
                    Arrays
                        .asList(
                            new BackupInner()
                                .withLocation("twuoegrpkhjwni")
                                .withLabel("yhrfouyftaakcpw")
                                .withUseExistingSnapshot(true)));
        model = BinaryData.fromObject(model).toObject(BackupsList.class);
        Assertions.assertEquals("twuoegrpkhjwni", model.value().get(0).location());
        Assertions.assertEquals("yhrfouyftaakcpw", model.value().get(0).label());
        Assertions.assertEquals(true, model.value().get(0).useExistingSnapshot());
    }
}
