// 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.BusinessIdentity;
import com.azure.resourcemanager.logic.models.X12AgreementContent;
import com.azure.resourcemanager.logic.models.X12OneWayAgreement;
import com.azure.resourcemanager.logic.models.X12ProtocolSettings;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class X12AgreementContentTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        X12AgreementContent model =
            BinaryData
                .fromString(
                    "{\"receiveAgreement\":{\"senderBusinessIdentity\":{\"qualifier\":\"yhgk\",\"value\":\"minsgowzf\"},\"receiverBusinessIdentity\":{\"qualifier\":\"tsttktlahbq\",\"value\":\"ctxtgzukxi\"},\"protocolSettings\":{\"envelopeOverrides\":[],\"validationOverrides\":[],\"messageFilterList\":[],\"schemaReferences\":[],\"x12DelimiterOverrides\":[]}},\"sendAgreement\":{\"senderBusinessIdentity\":{\"qualifier\":\"hrnxrxc\",\"value\":\"juisavokqdzf\"},\"receiverBusinessIdentity\":{\"qualifier\":\"azivjlfrqttbajl\",\"value\":\"atnwxyiopi\"},\"protocolSettings\":{\"envelopeOverrides\":[],\"validationOverrides\":[],\"messageFilterList\":[],\"schemaReferences\":[],\"x12DelimiterOverrides\":[]}}}")
                .toObject(X12AgreementContent.class);
        Assertions.assertEquals("yhgk", model.receiveAgreement().senderBusinessIdentity().qualifier());
        Assertions.assertEquals("minsgowzf", model.receiveAgreement().senderBusinessIdentity().value());
        Assertions.assertEquals("tsttktlahbq", model.receiveAgreement().receiverBusinessIdentity().qualifier());
        Assertions.assertEquals("ctxtgzukxi", model.receiveAgreement().receiverBusinessIdentity().value());
        Assertions.assertEquals("hrnxrxc", model.sendAgreement().senderBusinessIdentity().qualifier());
        Assertions.assertEquals("juisavokqdzf", model.sendAgreement().senderBusinessIdentity().value());
        Assertions.assertEquals("azivjlfrqttbajl", model.sendAgreement().receiverBusinessIdentity().qualifier());
        Assertions.assertEquals("atnwxyiopi", model.sendAgreement().receiverBusinessIdentity().value());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        X12AgreementContent model =
            new X12AgreementContent()
                .withReceiveAgreement(
                    new X12OneWayAgreement()
                        .withSenderBusinessIdentity(new BusinessIdentity().withQualifier("yhgk").withValue("minsgowzf"))
                        .withReceiverBusinessIdentity(
                            new BusinessIdentity().withQualifier("tsttktlahbq").withValue("ctxtgzukxi"))
                        .withProtocolSettings(
                            new X12ProtocolSettings()
                                .withEnvelopeOverrides(Arrays.asList())
                                .withValidationOverrides(Arrays.asList())
                                .withMessageFilterList(Arrays.asList())
                                .withSchemaReferences(Arrays.asList())
                                .withX12DelimiterOverrides(Arrays.asList())))
                .withSendAgreement(
                    new X12OneWayAgreement()
                        .withSenderBusinessIdentity(
                            new BusinessIdentity().withQualifier("hrnxrxc").withValue("juisavokqdzf"))
                        .withReceiverBusinessIdentity(
                            new BusinessIdentity().withQualifier("azivjlfrqttbajl").withValue("atnwxyiopi"))
                        .withProtocolSettings(
                            new X12ProtocolSettings()
                                .withEnvelopeOverrides(Arrays.asList())
                                .withValidationOverrides(Arrays.asList())
                                .withMessageFilterList(Arrays.asList())
                                .withSchemaReferences(Arrays.asList())
                                .withX12DelimiterOverrides(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(X12AgreementContent.class);
        Assertions.assertEquals("yhgk", model.receiveAgreement().senderBusinessIdentity().qualifier());
        Assertions.assertEquals("minsgowzf", model.receiveAgreement().senderBusinessIdentity().value());
        Assertions.assertEquals("tsttktlahbq", model.receiveAgreement().receiverBusinessIdentity().qualifier());
        Assertions.assertEquals("ctxtgzukxi", model.receiveAgreement().receiverBusinessIdentity().value());
        Assertions.assertEquals("hrnxrxc", model.sendAgreement().senderBusinessIdentity().qualifier());
        Assertions.assertEquals("juisavokqdzf", model.sendAgreement().senderBusinessIdentity().value());
        Assertions.assertEquals("azivjlfrqttbajl", model.sendAgreement().receiverBusinessIdentity().qualifier());
        Assertions.assertEquals("atnwxyiopi", model.sendAgreement().receiverBusinessIdentity().value());
    }
}
