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

package com.azure.resourcemanager.storagecache.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.storagecache.models.CacheHealth;
import com.azure.resourcemanager.storagecache.models.HealthStateType;
import org.junit.jupiter.api.Assertions;

public final class CacheHealthTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CacheHealth model =
            BinaryData
                .fromString(
                    "{\"state\":\"UpgradeFailed\",\"statusDescription\":\"aq\",\"conditions\":[{\"timestamp\":\"2021-01-14T07:52:43Z\",\"message\":\"iidzyexzne\"},{\"timestamp\":\"2021-06-14T02:46Z\",\"message\":\"nr\"}]}")
                .toObject(CacheHealth.class);
        Assertions.assertEquals(HealthStateType.UPGRADE_FAILED, model.state());
        Assertions.assertEquals("aq", model.statusDescription());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CacheHealth model = new CacheHealth().withState(HealthStateType.UPGRADE_FAILED).withStatusDescription("aq");
        model = BinaryData.fromObject(model).toObject(CacheHealth.class);
        Assertions.assertEquals(HealthStateType.UPGRADE_FAILED, model.state());
        Assertions.assertEquals("aq", model.statusDescription());
    }
}
