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

package com.azure.resourcemanager.costmanagement.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.costmanagement.fluent.models.GenerateDetailedCostReportOperationResultInner;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class GenerateDetailedCostReportOperationResultInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        GenerateDetailedCostReportOperationResultInner model =
            BinaryData
                .fromString(
                    "{\"id\":\"tjivfxzsjabib\",\"name\":\"stawfsdjpvkv\",\"type\":\"jxbkzbzkdvn\",\"properties\":{\"expiryTime\":\"2021-03-28T13:01:06Z\",\"validTill\":\"2021-09-14T12:39:28Z\",\"downloadUrl\":\"r\"}}")
                .toObject(GenerateDetailedCostReportOperationResultInner.class);
        Assertions.assertEquals("tjivfxzsjabib", model.id());
        Assertions.assertEquals("stawfsdjpvkv", model.name());
        Assertions.assertEquals("jxbkzbzkdvn", model.type());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-14T12:39:28Z"), model.validTill());
        Assertions.assertEquals("r", model.downloadUrl());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        GenerateDetailedCostReportOperationResultInner model =
            new GenerateDetailedCostReportOperationResultInner()
                .withId("tjivfxzsjabib")
                .withName("stawfsdjpvkv")
                .withType("jxbkzbzkdvn")
                .withValidTill(OffsetDateTime.parse("2021-09-14T12:39:28Z"))
                .withDownloadUrl("r");
        model = BinaryData.fromObject(model).toObject(GenerateDetailedCostReportOperationResultInner.class);
        Assertions.assertEquals("tjivfxzsjabib", model.id());
        Assertions.assertEquals("stawfsdjpvkv", model.name());
        Assertions.assertEquals("jxbkzbzkdvn", model.type());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-14T12:39:28Z"), model.validTill());
        Assertions.assertEquals("r", model.downloadUrl());
    }
}
