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

package com.azure.resourcemanager.mediaservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mediaservices.fluent.models.ContentKeyPolicyInner;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyCollection;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ContentKeyPolicyCollectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ContentKeyPolicyCollection model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"policyId\":\"d3092765-cb8e-4571-b392-6eaf0d8dcb7b\",\"created\":\"2021-07-23T19:08:12Z\",\"lastModified\":\"2021-05-23T15:27:27Z\",\"description\":\"bttk\",\"options\":[]},\"id\":\"ywpnvjt\",\"name\":\"qnermclfplphoxu\",\"type\":\"crpab\"},{\"properties\":{\"policyId\":\"3cab265e-69a6-4ae7-9dcb-b1ff1aeb342e\",\"created\":\"2021-06-14T01:08:13Z\",\"lastModified\":\"2021-08-09T16:13:09Z\",\"description\":\"azqugxywpmueefj\",\"options\":[]},\"id\":\"fqkquj\",\"name\":\"dsuyonobgla\",\"type\":\"cq\"},{\"properties\":{\"policyId\":\"c5e16e04-c361-40ea-a6f3-0fbe7d2b2fe2\",\"created\":\"2020-12-28T11:59Z\",\"lastModified\":\"2021-06-14T17:54:44Z\",\"description\":\"dxyt\",\"options\":[]},\"id\":\"oyrxvwfudwpzntxh\",\"name\":\"zhlrqjb\",\"type\":\"ck\"},{\"properties\":{\"policyId\":\"cdeb7fc8-70c2-47e0-bbbf-15900aa467b5\",\"created\":\"2021-03-13T18:04:17Z\",\"lastModified\":\"2021-11-29T20:48:55Z\",\"description\":\"kyv\",\"options\":[]},\"id\":\"ca\",\"name\":\"uzbpzkafku\",\"type\":\"b\"}],\"@odata.nextLink\":\"nwbmeh\"}")
                .toObject(ContentKeyPolicyCollection.class);
        Assertions.assertEquals("bttk", model.value().get(0).description());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ContentKeyPolicyCollection model =
            new ContentKeyPolicyCollection()
                .withValue(
                    Arrays
                        .asList(
                            new ContentKeyPolicyInner().withDescription("bttk").withOptions(Arrays.asList()),
                            new ContentKeyPolicyInner().withDescription("azqugxywpmueefj").withOptions(Arrays.asList()),
                            new ContentKeyPolicyInner().withDescription("dxyt").withOptions(Arrays.asList()),
                            new ContentKeyPolicyInner().withDescription("kyv").withOptions(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(ContentKeyPolicyCollection.class);
        Assertions.assertEquals("bttk", model.value().get(0).description());
    }
}
