Search in sources :

Example 1 with NoSuchUserException

use of org.nhindirect.common.rest.auth.exceptions.NoSuchUserException in project nhin-d by DirectProject.

the class HashableBasicAuthValidator_authenticateRawTest method testAuthenticate_unknownUser_assertAssertException.

@Test
public void testAuthenticate_unknownUser_assertAssertException() throws Exception {
    BasicAuthValidator validator = buildValidator();
    boolean exceptionOccured = false;
    try {
        final String rawAuth = buildRawCredential("test", "password");
        validator.authenticate(rawAuth);
    } catch (NoSuchUserException e) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : BasicAuthValidator(org.nhindirect.common.rest.auth.BasicAuthValidator) NoSuchUserException(org.nhindirect.common.rest.auth.exceptions.NoSuchUserException) Test(org.junit.Test)

Example 2 with NoSuchUserException

use of org.nhindirect.common.rest.auth.exceptions.NoSuchUserException in project nhin-d by DirectProject.

the class HashableBasicAuthValidator_authenticateTest method testAuthenticate_unknownUser_assertAssertException.

@Test
public void testAuthenticate_unknownUser_assertAssertException() throws Exception {
    BasicAuthValidator validator = buildValidator();
    boolean exceptionOccured = false;
    try {
        validator.authenticate("test", "password");
    } catch (NoSuchUserException e) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : BasicAuthValidator(org.nhindirect.common.rest.auth.BasicAuthValidator) NoSuchUserException(org.nhindirect.common.rest.auth.exceptions.NoSuchUserException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 BasicAuthValidator (org.nhindirect.common.rest.auth.BasicAuthValidator)2 NoSuchUserException (org.nhindirect.common.rest.auth.exceptions.NoSuchUserException)2