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

package com.azure.resourcemanager.dataprotection.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.dataprotection.models.AzureBackupFindRestorableTimeRangesResponse;
import com.azure.resourcemanager.dataprotection.models.RestorableTimeRange;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AzureBackupFindRestorableTimeRangesResponseTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AzureBackupFindRestorableTimeRangesResponse model =
            BinaryData
                .fromString(
                    "{\"restorableTimeRanges\":[{\"startTime\":\"sd\",\"endTime\":\"touwaboekqv\",\"objectType\":\"lns\"}],\"objectType\":\"bxwyjsflhhcaa\"}")
                .toObject(AzureBackupFindRestorableTimeRangesResponse.class);
        Assertions.assertEquals("sd", model.restorableTimeRanges().get(0).startTime());
        Assertions.assertEquals("touwaboekqv", model.restorableTimeRanges().get(0).endTime());
        Assertions.assertEquals("lns", model.restorableTimeRanges().get(0).objectType());
        Assertions.assertEquals("bxwyjsflhhcaa", model.objectType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AzureBackupFindRestorableTimeRangesResponse model =
            new AzureBackupFindRestorableTimeRangesResponse()
                .withRestorableTimeRanges(
                    Arrays
                        .asList(
                            new RestorableTimeRange()
                                .withStartTime("sd")
                                .withEndTime("touwaboekqv")
                                .withObjectType("lns")))
                .withObjectType("bxwyjsflhhcaa");
        model = BinaryData.fromObject(model).toObject(AzureBackupFindRestorableTimeRangesResponse.class);
        Assertions.assertEquals("sd", model.restorableTimeRanges().get(0).startTime());
        Assertions.assertEquals("touwaboekqv", model.restorableTimeRanges().get(0).endTime());
        Assertions.assertEquals("lns", model.restorableTimeRanges().get(0).objectType());
        Assertions.assertEquals("bxwyjsflhhcaa", model.objectType());
    }
}
