Search in sources :

Example 1 with AuthTokenService

use of org.summerb.users.api.AuthTokenService in project summerb by skarpushin.

the class AuthTokenServiceDbImplTest method testFindUserAuthTokens_defensive_nullUser.

@Test(expected = IllegalArgumentException.class)
public void testFindUserAuthTokens_defensive_nullUser() throws Exception {
    AuthTokenService fixture = AuthTokenServiceDbImplFactory.createAuthTokenServiceDbImpl();
    fixture.findUserAuthTokens(null);
    fail();
}
Also used : AuthTokenService(org.summerb.users.api.AuthTokenService) Test(org.junit.Test)

Example 2 with AuthTokenService

use of org.summerb.users.api.AuthTokenService in project summerb by skarpushin.

the class AuthTokenServiceDbImplTest method testCreateAuthToken_defensive_clientIpNull.

@Test(expected = IllegalArgumentException.class)
public void testCreateAuthToken_defensive_clientIpNull() throws Exception {
    AuthTokenService fixture = AuthTokenServiceDbImplFactory.createAuthTokenServiceDbImpl();
    fixture.authenticate("", "", null);
    fail();
}
Also used : AuthTokenService(org.summerb.users.api.AuthTokenService) Test(org.junit.Test)

Example 3 with AuthTokenService

use of org.summerb.users.api.AuthTokenService in project summerb by skarpushin.

the class AuthTokenServiceDbImplTest method testCreateAuthToken_blackbox_expectFieldValidationException.

@Test(expected = FieldValidationException.class)
public void testCreateAuthToken_blackbox_expectFieldValidationException() throws Exception {
    AuthTokenService fixture = AuthTokenServiceDbImplFactory.createAuthTokenServiceDbImpl();
    fixture.authenticate("abra cadabra", "", "");
    fail();
}
Also used : AuthTokenService(org.summerb.users.api.AuthTokenService) Test(org.junit.Test)

Example 4 with AuthTokenService

use of org.summerb.users.api.AuthTokenService in project summerb by skarpushin.

the class AuthTokenServiceDbImplTest method testCreateAuthToken_blackbox_expectUserNotFoundExpcetion.

@Test(expected = UserNotFoundException.class)
public void testCreateAuthToken_blackbox_expectUserNotFoundExpcetion() throws Exception {
    AuthTokenService fixture = AuthTokenServiceDbImplFactory.createAuthTokenServiceDbImpl();
    fixture.authenticate(UserFactory.NON_EXISTENT_USER_EMAIL, "", "");
    fail();
}
Also used : AuthTokenService(org.summerb.users.api.AuthTokenService) Test(org.junit.Test)

Example 5 with AuthTokenService

use of org.summerb.users.api.AuthTokenService in project summerb by skarpushin.

the class AuthTokenServiceDbImplTest method testFindUserAuthTokens_whitebox_expectUserNotFoundExceptionForNonExistentUser.

@Test(expected = UserNotFoundException.class)
public void testFindUserAuthTokens_whitebox_expectUserNotFoundExceptionForNonExistentUser() throws Exception {
    AuthTokenService fixture = AuthTokenServiceDbImplFactory.createAuthTokenServiceDbImpl();
    fixture.findUserAuthTokens(UserFactory.NON_EXISTENT_USER);
    fail();
}
Also used : AuthTokenService(org.summerb.users.api.AuthTokenService) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)11 AuthTokenService (org.summerb.users.api.AuthTokenService)11 AuthToken (org.summerb.users.api.dto.AuthToken)1