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

package com.azure.resourcemanager.hybridnetwork.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hybridnetwork.fluent.models.RoleInstanceInner;
import com.azure.resourcemanager.hybridnetwork.models.OperationalState;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class RoleInstanceInnerTests {
    @Test
    public void testDeserialize() {
        RoleInstanceInner model =
            BinaryData
                .fromString(
                    "{\"name\":\"fuwutttxf\",\"id\":\"brjcxe\",\"type\":\"jrbirphxepcyv\",\"properties\":{\"provisioningState\":\"Unknown\",\"operationalState\":\"Stopping\"}}")
                .toObject(RoleInstanceInner.class);
        Assertions.assertEquals("fuwutttxf", model.name());
        Assertions.assertEquals("brjcxe", model.id());
        Assertions.assertEquals("jrbirphxepcyv", model.type());
        Assertions.assertEquals(OperationalState.STOPPING, model.operationalState());
    }

    @Test
    public void testSerialize() {
        RoleInstanceInner model =
            new RoleInstanceInner()
                .withName("fuwutttxf")
                .withId("brjcxe")
                .withType("jrbirphxepcyv")
                .withOperationalState(OperationalState.STOPPING);
        model = BinaryData.fromObject(model).toObject(RoleInstanceInner.class);
        Assertions.assertEquals("fuwutttxf", model.name());
        Assertions.assertEquals("brjcxe", model.id());
        Assertions.assertEquals("jrbirphxepcyv", model.type());
        Assertions.assertEquals(OperationalState.STOPPING, model.operationalState());
    }
}
