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

package com.azure.resourcemanager.kubernetesconfiguration.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.kubernetesconfiguration.models.GitRepositoryDefinition;
import com.azure.resourcemanager.kubernetesconfiguration.models.RepositoryRefDefinition;
import org.junit.jupiter.api.Assertions;

public final class GitRepositoryDefinitionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        GitRepositoryDefinition model =
            BinaryData
                .fromString(
                    "{\"url\":\"utduqktapspwgcu\",\"timeoutInSeconds\":5235173509152670930,\"syncIntervalInSeconds\":7020809285560485144,\"repositoryRef\":{\"branch\":\"vqwhbmdgbbjfd\",\"tag\":\"mbmbexppbh\",\"semver\":\"qrolfpf\",\"commit\":\"algbquxigjyjg\"},\"sshKnownHosts\":\"aoyfhrtxilnerkuj\",\"httpsUser\":\"vlejuvfqa\",\"httpsCACert\":\"lyxwjkcprbnwbx\",\"localAuthRef\":\"vtb\"}")
                .toObject(GitRepositoryDefinition.class);
        Assertions.assertEquals("utduqktapspwgcu", model.url());
        Assertions.assertEquals(5235173509152670930L, model.timeoutInSeconds());
        Assertions.assertEquals(7020809285560485144L, model.syncIntervalInSeconds());
        Assertions.assertEquals("vqwhbmdgbbjfd", model.repositoryRef().branch());
        Assertions.assertEquals("mbmbexppbh", model.repositoryRef().tag());
        Assertions.assertEquals("qrolfpf", model.repositoryRef().semver());
        Assertions.assertEquals("algbquxigjyjg", model.repositoryRef().commit());
        Assertions.assertEquals("aoyfhrtxilnerkuj", model.sshKnownHosts());
        Assertions.assertEquals("vlejuvfqa", model.httpsUser());
        Assertions.assertEquals("lyxwjkcprbnwbx", model.httpsCACert());
        Assertions.assertEquals("vtb", model.localAuthRef());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        GitRepositoryDefinition model =
            new GitRepositoryDefinition()
                .withUrl("utduqktapspwgcu")
                .withTimeoutInSeconds(5235173509152670930L)
                .withSyncIntervalInSeconds(7020809285560485144L)
                .withRepositoryRef(
                    new RepositoryRefDefinition()
                        .withBranch("vqwhbmdgbbjfd")
                        .withTag("mbmbexppbh")
                        .withSemver("qrolfpf")
                        .withCommit("algbquxigjyjg"))
                .withSshKnownHosts("aoyfhrtxilnerkuj")
                .withHttpsUser("vlejuvfqa")
                .withHttpsCACert("lyxwjkcprbnwbx")
                .withLocalAuthRef("vtb");
        model = BinaryData.fromObject(model).toObject(GitRepositoryDefinition.class);
        Assertions.assertEquals("utduqktapspwgcu", model.url());
        Assertions.assertEquals(5235173509152670930L, model.timeoutInSeconds());
        Assertions.assertEquals(7020809285560485144L, model.syncIntervalInSeconds());
        Assertions.assertEquals("vqwhbmdgbbjfd", model.repositoryRef().branch());
        Assertions.assertEquals("mbmbexppbh", model.repositoryRef().tag());
        Assertions.assertEquals("qrolfpf", model.repositoryRef().semver());
        Assertions.assertEquals("algbquxigjyjg", model.repositoryRef().commit());
        Assertions.assertEquals("aoyfhrtxilnerkuj", model.sshKnownHosts());
        Assertions.assertEquals("vlejuvfqa", model.httpsUser());
        Assertions.assertEquals("lyxwjkcprbnwbx", model.httpsCACert());
        Assertions.assertEquals("vtb", model.localAuthRef());
    }
}
