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

package com.azure.resourcemanager.confidentialledger.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.confidentialledger.models.CertBasedSecurityPrincipal;
import com.azure.resourcemanager.confidentialledger.models.LedgerRoleName;
import org.junit.jupiter.api.Assertions;

public final class CertBasedSecurityPrincipalTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CertBasedSecurityPrincipal model =
            BinaryData
                .fromString("{\"cert\":\"vyevcciqi\",\"ledgerRoleName\":\"Contributor\"}")
                .toObject(CertBasedSecurityPrincipal.class);
        Assertions.assertEquals("vyevcciqi", model.cert());
        Assertions.assertEquals(LedgerRoleName.CONTRIBUTOR, model.ledgerRoleName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CertBasedSecurityPrincipal model =
            new CertBasedSecurityPrincipal().withCert("vyevcciqi").withLedgerRoleName(LedgerRoleName.CONTRIBUTOR);
        model = BinaryData.fromObject(model).toObject(CertBasedSecurityPrincipal.class);
        Assertions.assertEquals("vyevcciqi", model.cert());
        Assertions.assertEquals(LedgerRoleName.CONTRIBUTOR, model.ledgerRoleName());
    }
}
