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

import com.atlassian.bitbucket.internal.mirroring.mirror.ExternalRepository;
import com.atlassian.bitbucket.internal.mirroring.mirror.MinimalExternalRepository;
import org.junit.Test;

import static com.atlassian.bitbucket.internal.mirroring.mirror.rest.cloud.RestCloudTestUtils.assertRepository;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;

public abstract class CloudRepositoryWebHookEventTestBase<R extends BaseRestCloudRepositoryWebHookEvent> {
    @Test
    public void testRepositoryDetails() throws Exception {
        R event = loadDefaultPayload();

        MinimalExternalRepository repository = event.getRepository();
        assertNotNull(repository);
        assertFalse(repository instanceof ExternalRepository);

        assertRepository(repository, "{77d94df8-8cf7-4c2f-83a3-ae50acf0ecc6}", false, "test", "test", "git");
    }

    protected abstract R loadDefaultPayload();
}
