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

package com.azure.resourcemanager.policyinsights.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.policyinsights.fluent.models.AttestationInner;
import com.azure.resourcemanager.policyinsights.models.AttestationEvidence;
import com.azure.resourcemanager.policyinsights.models.ComplianceState;
import java.time.OffsetDateTime;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class AttestationInnerTests {
    @Test
    public void testDeserialize() {
        AttestationInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"policyAssignmentId\":\"ygqukyhejh\",\"policyDefinitionReferenceId\":\"sx\",\"complianceState\":\"Compliant\",\"expiresOn\":\"2021-09-01T11:17:58Z\",\"owner\":\"lppvksrpq\",\"comments\":\"jzraehtwdwrf\",\"evidence\":[{\"description\":\"byrcdlbhshfwp\",\"sourceUri\":\"cstwity\"}],\"provisioningState\":\"evxccedcp\",\"lastComplianceStateChangeAt\":\"2021-05-27T10:40:38Z\",\"assessmentDate\":\"2021-02-03T02:01:52Z\"},\"id\":\"wzxltjc\",\"name\":\"nhltiugcxn\",\"type\":\"vvwxqi\"}")
                .toObject(AttestationInner.class);
        Assertions.assertEquals("ygqukyhejh", model.policyAssignmentId());
        Assertions.assertEquals("sx", model.policyDefinitionReferenceId());
        Assertions.assertEquals(ComplianceState.COMPLIANT, model.complianceState());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-01T11:17:58Z"), model.expiresOn());
        Assertions.assertEquals("lppvksrpq", model.owner());
        Assertions.assertEquals("jzraehtwdwrf", model.comments());
        Assertions.assertEquals("byrcdlbhshfwp", model.evidence().get(0).description());
        Assertions.assertEquals("cstwity", model.evidence().get(0).sourceUri());
        Assertions.assertEquals(OffsetDateTime.parse("2021-02-03T02:01:52Z"), model.assessmentDate());
    }

    @Test
    public void testSerialize() {
        AttestationInner model =
            new AttestationInner()
                .withPolicyAssignmentId("ygqukyhejh")
                .withPolicyDefinitionReferenceId("sx")
                .withComplianceState(ComplianceState.COMPLIANT)
                .withExpiresOn(OffsetDateTime.parse("2021-09-01T11:17:58Z"))
                .withOwner("lppvksrpq")
                .withComments("jzraehtwdwrf")
                .withEvidence(
                    Arrays.asList(new AttestationEvidence().withDescription("byrcdlbhshfwp").withSourceUri("cstwity")))
                .withAssessmentDate(OffsetDateTime.parse("2021-02-03T02:01:52Z"));
        model = BinaryData.fromObject(model).toObject(AttestationInner.class);
        Assertions.assertEquals("ygqukyhejh", model.policyAssignmentId());
        Assertions.assertEquals("sx", model.policyDefinitionReferenceId());
        Assertions.assertEquals(ComplianceState.COMPLIANT, model.complianceState());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-01T11:17:58Z"), model.expiresOn());
        Assertions.assertEquals("lppvksrpq", model.owner());
        Assertions.assertEquals("jzraehtwdwrf", model.comments());
        Assertions.assertEquals("byrcdlbhshfwp", model.evidence().get(0).description());
        Assertions.assertEquals("cstwity", model.evidence().get(0).sourceUri());
        Assertions.assertEquals(OffsetDateTime.parse("2021-02-03T02:01:52Z"), model.assessmentDate());
    }
}
