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

public final class EdifactValidationSettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        EdifactValidationSettings model =
            BinaryData
                .fromString(
                    "{\"validateCharacterSet\":false,\"checkDuplicateInterchangeControlNumber\":true,\"interchangeControlNumberValidityDays\":194924410,\"checkDuplicateGroupControlNumber\":false,\"checkDuplicateTransactionSetControlNumber\":false,\"validateEDITypes\":false,\"validateXSDTypes\":false,\"allowLeadingAndTrailingSpacesAndZeroes\":true,\"trimLeadingAndTrailingSpacesAndZeroes\":true,\"trailingSeparatorPolicy\":\"NotAllowed\"}")
                .toObject(EdifactValidationSettings.class);
        Assertions.assertEquals(false, model.validateCharacterSet());
        Assertions.assertEquals(true, model.checkDuplicateInterchangeControlNumber());
        Assertions.assertEquals(194924410, model.interchangeControlNumberValidityDays());
        Assertions.assertEquals(false, model.checkDuplicateGroupControlNumber());
        Assertions.assertEquals(false, model.checkDuplicateTransactionSetControlNumber());
        Assertions.assertEquals(false, model.validateEdiTypes());
        Assertions.assertEquals(false, model.validateXsdTypes());
        Assertions.assertEquals(true, model.allowLeadingAndTrailingSpacesAndZeroes());
        Assertions.assertEquals(true, model.trimLeadingAndTrailingSpacesAndZeroes());
        Assertions.assertEquals(TrailingSeparatorPolicy.NOT_ALLOWED, model.trailingSeparatorPolicy());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        EdifactValidationSettings model =
            new EdifactValidationSettings()
                .withValidateCharacterSet(false)
                .withCheckDuplicateInterchangeControlNumber(true)
                .withInterchangeControlNumberValidityDays(194924410)
                .withCheckDuplicateGroupControlNumber(false)
                .withCheckDuplicateTransactionSetControlNumber(false)
                .withValidateEdiTypes(false)
                .withValidateXsdTypes(false)
                .withAllowLeadingAndTrailingSpacesAndZeroes(true)
                .withTrimLeadingAndTrailingSpacesAndZeroes(true)
                .withTrailingSeparatorPolicy(TrailingSeparatorPolicy.NOT_ALLOWED);
        model = BinaryData.fromObject(model).toObject(EdifactValidationSettings.class);
        Assertions.assertEquals(false, model.validateCharacterSet());
        Assertions.assertEquals(true, model.checkDuplicateInterchangeControlNumber());
        Assertions.assertEquals(194924410, model.interchangeControlNumberValidityDays());
        Assertions.assertEquals(false, model.checkDuplicateGroupControlNumber());
        Assertions.assertEquals(false, model.checkDuplicateTransactionSetControlNumber());
        Assertions.assertEquals(false, model.validateEdiTypes());
        Assertions.assertEquals(false, model.validateXsdTypes());
        Assertions.assertEquals(true, model.allowLeadingAndTrailingSpacesAndZeroes());
        Assertions.assertEquals(true, model.trimLeadingAndTrailingSpacesAndZeroes());
        Assertions.assertEquals(TrailingSeparatorPolicy.NOT_ALLOWED, model.trailingSeparatorPolicy());
    }
}
