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

package com.azure.resourcemanager.logic.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.logic.fluent.models.KeyVaultKeyInner;
import com.azure.resourcemanager.logic.models.KeyVaultKeyAttributes;
import org.junit.jupiter.api.Assertions;

public final class KeyVaultKeyInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        KeyVaultKeyInner model =
            BinaryData
                .fromString(
                    "{\"kid\":\"dcfhucqdpf\",\"attributes\":{\"enabled\":true,\"created\":3408443666181567274,\"updated\":1956794003061019493}}")
                .toObject(KeyVaultKeyInner.class);
        Assertions.assertEquals("dcfhucqdpf", model.kid());
        Assertions.assertEquals(true, model.attributes().enabled());
        Assertions.assertEquals(3408443666181567274L, model.attributes().created());
        Assertions.assertEquals(1956794003061019493L, model.attributes().updated());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        KeyVaultKeyInner model =
            new KeyVaultKeyInner()
                .withKid("dcfhucqdpf")
                .withAttributes(
                    new KeyVaultKeyAttributes()
                        .withEnabled(true)
                        .withCreated(3408443666181567274L)
                        .withUpdated(1956794003061019493L));
        model = BinaryData.fromObject(model).toObject(KeyVaultKeyInner.class);
        Assertions.assertEquals("dcfhucqdpf", model.kid());
        Assertions.assertEquals(true, model.attributes().enabled());
        Assertions.assertEquals(3408443666181567274L, model.attributes().created());
        Assertions.assertEquals(1956794003061019493L, model.attributes().updated());
    }
}
