package com.atlassian.bitbucket.internal.mirroring.mirror.rest.cloud;

import com.atlassian.bitbucket.internal.mirroring.mirror.ExternalProject;
import com.atlassian.bitbucket.internal.mirroring.mirror.MinimalExternalRepository;
import com.atlassian.bitbucket.mirroring.mirror.UpstreamAccount;

import java.util.Optional;

import static org.junit.Assert.*;

public class RestCloudTestUtils {
    public static void assertAccount(Optional<UpstreamAccount> owner, String id, String name) {
        assertTrue(owner.isPresent());
        assertEquals(id, owner.get().getId());
        assertEquals(name, owner.get().getName());
    }

    public static void assertProject(ExternalProject project, String id, String key, String name) {
        assertNotNull(project);
        assertEquals(id, project.getId());
        assertEquals(key, project.getKey());
        assertEquals(name, project.getName());
    }

    public static void assertRepository(MinimalExternalRepository repository, String id, boolean isPublic, String name, String slug, String scm) {
        assertEquals(id, repository.getId());
        assertEquals(isPublic, repository.isPublic());
        assertEquals(name, repository.getName());
        assertEquals(slug, repository.getSlug());
        assertEquals(scm, repository.getScmId());
    }
}
