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

package com.azure.resourcemanager.databoxedge.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.databoxedge.models.AsymmetricEncryptedSecret;
import com.azure.resourcemanager.databoxedge.models.EncryptionAlgorithm;
import com.azure.resourcemanager.databoxedge.models.SymmetricKey;
import org.junit.jupiter.api.Assertions;

public final class SymmetricKeyTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SymmetricKey model =
            BinaryData
                .fromString(
                    "{\"connectionString\":{\"value\":\"qdpfuvglsbjjca\",\"encryptionCertThumbprint\":\"xbvtvudu\",\"encryptionAlgorithm\":\"AES256\"}}")
                .toObject(SymmetricKey.class);
        Assertions.assertEquals("qdpfuvglsbjjca", model.connectionString().value());
        Assertions.assertEquals("xbvtvudu", model.connectionString().encryptionCertThumbprint());
        Assertions.assertEquals(EncryptionAlgorithm.AES256, model.connectionString().encryptionAlgorithm());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SymmetricKey model =
            new SymmetricKey()
                .withConnectionString(
                    new AsymmetricEncryptedSecret()
                        .withValue("qdpfuvglsbjjca")
                        .withEncryptionCertThumbprint("xbvtvudu")
                        .withEncryptionAlgorithm(EncryptionAlgorithm.AES256));
        model = BinaryData.fromObject(model).toObject(SymmetricKey.class);
        Assertions.assertEquals("qdpfuvglsbjjca", model.connectionString().value());
        Assertions.assertEquals("xbvtvudu", model.connectionString().encryptionCertThumbprint());
        Assertions.assertEquals(EncryptionAlgorithm.AES256, model.connectionString().encryptionAlgorithm());
    }
}
