// 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.models.ArtifactContentPropertiesDefinition;
import com.azure.resourcemanager.logic.models.ContentLink;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class ArtifactContentPropertiesDefinitionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ArtifactContentPropertiesDefinition model =
            BinaryData
                .fromString(
                    "{\"content\":\"datandsytgadg\",\"contentType\":\"aeaeneqnzarrw\",\"contentLink\":{\"uri\":\"uijfqk\",\"contentVersion\":\"e\",\"contentSize\":9040428680411345053,\"contentHash\":{\"algorithm\":\"ubjibww\",\"value\":\"tohqkvpuvksgp\"},\"metadata\":\"dataaknynfsynljphuop\"},\"createdTime\":\"2021-05-14T18:56:32Z\",\"changedTime\":\"2021-08-24T08:24:23Z\",\"metadata\":\"dataynt\"}")
                .toObject(ArtifactContentPropertiesDefinition.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-05-14T18:56:32Z"), model.createdTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-24T08:24:23Z"), model.changedTime());
        Assertions.assertEquals("aeaeneqnzarrw", model.contentType());
        Assertions.assertEquals("uijfqk", model.contentLink().uri());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ArtifactContentPropertiesDefinition model =
            new ArtifactContentPropertiesDefinition()
                .withCreatedTime(OffsetDateTime.parse("2021-05-14T18:56:32Z"))
                .withChangedTime(OffsetDateTime.parse("2021-08-24T08:24:23Z"))
                .withMetadata("dataynt")
                .withContent("datandsytgadg")
                .withContentType("aeaeneqnzarrw")
                .withContentLink(new ContentLink().withUri("uijfqk"));
        model = BinaryData.fromObject(model).toObject(ArtifactContentPropertiesDefinition.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-05-14T18:56:32Z"), model.createdTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-24T08:24:23Z"), model.changedTime());
        Assertions.assertEquals("aeaeneqnzarrw", model.contentType());
        Assertions.assertEquals("uijfqk", model.contentLink().uri());
    }
}
