// 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.SegmentTerminatorSuffix;
import com.azure.resourcemanager.logic.models.X12CharacterSet;
import com.azure.resourcemanager.logic.models.X12FramingSettings;
import org.junit.jupiter.api.Assertions;

public final class X12FramingSettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        X12FramingSettings model =
            BinaryData
                .fromString(
                    "{\"dataElementSeparator\":1165309637,\"componentSeparator\":2128270651,\"replaceSeparatorsInPayload\":true,\"replaceCharacter\":206197210,\"segmentTerminator\":1485763904,\"characterSet\":\"UTF8\",\"segmentTerminatorSuffix\":\"None\"}")
                .toObject(X12FramingSettings.class);
        Assertions.assertEquals(1165309637, model.dataElementSeparator());
        Assertions.assertEquals(2128270651, model.componentSeparator());
        Assertions.assertEquals(true, model.replaceSeparatorsInPayload());
        Assertions.assertEquals(206197210, model.replaceCharacter());
        Assertions.assertEquals(1485763904, model.segmentTerminator());
        Assertions.assertEquals(X12CharacterSet.UTF8, model.characterSet());
        Assertions.assertEquals(SegmentTerminatorSuffix.NONE, model.segmentTerminatorSuffix());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        X12FramingSettings model =
            new X12FramingSettings()
                .withDataElementSeparator(1165309637)
                .withComponentSeparator(2128270651)
                .withReplaceSeparatorsInPayload(true)
                .withReplaceCharacter(206197210)
                .withSegmentTerminator(1485763904)
                .withCharacterSet(X12CharacterSet.UTF8)
                .withSegmentTerminatorSuffix(SegmentTerminatorSuffix.NONE);
        model = BinaryData.fromObject(model).toObject(X12FramingSettings.class);
        Assertions.assertEquals(1165309637, model.dataElementSeparator());
        Assertions.assertEquals(2128270651, model.componentSeparator());
        Assertions.assertEquals(true, model.replaceSeparatorsInPayload());
        Assertions.assertEquals(206197210, model.replaceCharacter());
        Assertions.assertEquals(1485763904, model.segmentTerminator());
        Assertions.assertEquals(X12CharacterSet.UTF8, model.characterSet());
        Assertions.assertEquals(SegmentTerminatorSuffix.NONE, model.segmentTerminatorSuffix());
    }
}
