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

package com.azure.resourcemanager.recoveryservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.recoveryservices.models.CapabilitiesResponseProperties;
import com.azure.resourcemanager.recoveryservices.models.DnsZoneResponse;
import com.azure.resourcemanager.recoveryservices.models.VaultSubResourceType;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class CapabilitiesResponsePropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CapabilitiesResponseProperties model =
            BinaryData
                .fromString(
                    "{\"dnsZones\":[{\"requiredZoneNames\":[\"lluwfzitonpeq\",\"pjkjlxofpdv\",\"pfxxy\"],\"subResource\":\"AzureBackup_secondary\"},{\"requiredZoneNames\":[\"mayhuybbkpodepoo\",\"inuvamiheogn\",\"rxzxtheo\"],\"subResource\":\"AzureBackup\"}]}")
                .toObject(CapabilitiesResponseProperties.class);
        Assertions.assertEquals(VaultSubResourceType.AZURE_BACKUP_SECONDARY, model.dnsZones().get(0).subResource());
        Assertions.assertEquals("lluwfzitonpeq", model.dnsZones().get(0).requiredZoneNames().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CapabilitiesResponseProperties model =
            new CapabilitiesResponseProperties()
                .withDnsZones(
                    Arrays
                        .asList(
                            new DnsZoneResponse()
                                .withSubResource(VaultSubResourceType.AZURE_BACKUP_SECONDARY)
                                .withRequiredZoneNames(Arrays.asList("lluwfzitonpeq", "pjkjlxofpdv", "pfxxy")),
                            new DnsZoneResponse()
                                .withSubResource(VaultSubResourceType.AZURE_BACKUP)
                                .withRequiredZoneNames(Arrays.asList("mayhuybbkpodepoo", "inuvamiheogn", "rxzxtheo"))));
        model = BinaryData.fromObject(model).toObject(CapabilitiesResponseProperties.class);
        Assertions.assertEquals(VaultSubResourceType.AZURE_BACKUP_SECONDARY, model.dnsZones().get(0).subResource());
        Assertions.assertEquals("lluwfzitonpeq", model.dnsZones().get(0).requiredZoneNames().get(0));
    }
}
