package com.atlassian.stash.internal.user;

import com.atlassian.bitbucket.user.ApplicationUser;
import com.atlassian.bitbucket.user.DetailedUser;
import com.atlassian.bitbucket.user.ServiceUser;
import org.junit.Test;

import static com.atlassian.stash.internal.user.InternalUserUtils.isInternalUser;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class InternalUserUtilsTest {
    @Test
    public void testInternalUserIdentification() throws Exception {
        assertTrue(isInternalUser(UserTestUtils.createMockNormalUser(InternalApplicationUser.class)));
        assertTrue(isInternalUser(UserTestUtils.createMockNormalUser(InternalNormalUser.class)));
        assertTrue(isInternalUser(UserTestUtils.createMockServiceUser(InternalServiceUser.class)));
        assertTrue(isInternalUser(UserTestUtils.createMockDetailedUser(InternalDetailedUser.class)));

        assertFalse(isInternalUser(UserTestUtils.createMockNormalUser(ApplicationUser.class)));
        assertFalse(isInternalUser(UserTestUtils.createMockServiceUser(ServiceUser.class)));
        assertFalse(isInternalUser(UserTestUtils.createMockDetailedUser(DetailedUser.class)));
    }
}