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

package com.azure.resourcemanager.purview.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.purview.fluent.models.PrivateEndpointConnectionProperties;
import com.azure.resourcemanager.purview.models.PrivateEndpoint;
import com.azure.resourcemanager.purview.models.PrivateLinkServiceConnectionState;
import com.azure.resourcemanager.purview.models.Status;
import org.junit.jupiter.api.Assertions;

public final class PrivateEndpointConnectionPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PrivateEndpointConnectionProperties model =
            BinaryData
                .fromString(
                    "{\"privateEndpoint\":{\"id\":\"ifiyipjxsqwpgrj\"},\"privateLinkServiceConnectionState\":{\"actionsRequired\":\"orcjxvsnby\",\"description\":\"abnmocpcyshu\",\"status\":\"Unknown\"},\"provisioningState\":\"bl\"}")
                .toObject(PrivateEndpointConnectionProperties.class);
        Assertions.assertEquals("ifiyipjxsqwpgrj", model.privateEndpoint().id());
        Assertions.assertEquals("orcjxvsnby", model.privateLinkServiceConnectionState().actionsRequired());
        Assertions.assertEquals("abnmocpcyshu", model.privateLinkServiceConnectionState().description());
        Assertions.assertEquals(Status.UNKNOWN, model.privateLinkServiceConnectionState().status());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PrivateEndpointConnectionProperties model =
            new PrivateEndpointConnectionProperties()
                .withPrivateEndpoint(new PrivateEndpoint().withId("ifiyipjxsqwpgrj"))
                .withPrivateLinkServiceConnectionState(
                    new PrivateLinkServiceConnectionState()
                        .withActionsRequired("orcjxvsnby")
                        .withDescription("abnmocpcyshu")
                        .withStatus(Status.UNKNOWN));
        model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionProperties.class);
        Assertions.assertEquals("ifiyipjxsqwpgrj", model.privateEndpoint().id());
        Assertions.assertEquals("orcjxvsnby", model.privateLinkServiceConnectionState().actionsRequired());
        Assertions.assertEquals("abnmocpcyshu", model.privateLinkServiceConnectionState().description());
        Assertions.assertEquals(Status.UNKNOWN, model.privateLinkServiceConnectionState().status());
    }
}
