Expand test coverage.
This commit is contained in:
parent
9176aa0efb
commit
d6207106c0
|
@ -66,6 +66,8 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setAuthenticationDao(new MockAuthenticationDaoUserMarissa());
|
||||
provider.setUserCache(new MockUserCache());
|
||||
provider.setApplicationContext(new ClassPathXmlApplicationContext(
|
||||
"net/sf/acegisecurity/util/filtertest-valid.xml"));
|
||||
|
||||
try {
|
||||
provider.authenticate(token);
|
||||
|
@ -89,6 +91,16 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
} catch (AccountExpiredException expected) {
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
provider.setApplicationContext(new ClassPathXmlApplicationContext(
|
||||
"net/sf/acegisecurity/util/filtertest-valid.xml"));
|
||||
|
||||
try {
|
||||
provider.authenticate(token);
|
||||
fail("Should have thrown AccountExpiredException");
|
||||
} catch (AccountExpiredException expected) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void testAuthenticateFailsIfCredentialsExpired() {
|
||||
|
@ -105,6 +117,16 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
} catch (CredentialsExpiredException expected) {
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
provider.setApplicationContext(new ClassPathXmlApplicationContext(
|
||||
"net/sf/acegisecurity/util/filtertest-valid.xml"));
|
||||
|
||||
try {
|
||||
provider.authenticate(token);
|
||||
fail("Should have thrown CredentialsExpiredException");
|
||||
} catch (CredentialsExpiredException expected) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void testAuthenticateFailsIfUserDisabled() {
|
||||
|
@ -121,6 +143,16 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|||
} catch (DisabledException expected) {
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
provider.setApplicationContext(new ClassPathXmlApplicationContext(
|
||||
"net/sf/acegisecurity/util/filtertest-valid.xml"));
|
||||
|
||||
try {
|
||||
provider.authenticate(token);
|
||||
fail("Should have thrown DisabledException");
|
||||
} catch (DisabledException expected) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void testAuthenticateFailsWhenAuthenticationDaoHasBackendFailure() {
|
||||
|
|
|
@ -31,6 +31,8 @@ import net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
|||
import net.sf.acegisecurity.providers.dao.cache.EhCacheBasedUserCache;
|
||||
import net.sf.acegisecurity.providers.dao.cache.NullUserCache;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.DataRetrievalFailureException;
|
||||
|
||||
|
@ -84,6 +86,16 @@ public class PasswordDaoAuthenticationProviderTests extends TestCase {
|
|||
} catch (AccountExpiredException expected) {
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
provider.setApplicationContext(new ClassPathXmlApplicationContext(
|
||||
"net/sf/acegisecurity/util/filtertest-valid.xml"));
|
||||
|
||||
try {
|
||||
provider.authenticate(token);
|
||||
fail("Should have thrown AccountExpiredException");
|
||||
} catch (AccountExpiredException expected) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void testAuthenticateFailsIfCredentialsExpired() {
|
||||
|
@ -100,6 +112,16 @@ public class PasswordDaoAuthenticationProviderTests extends TestCase {
|
|||
} catch (CredentialsExpiredException expected) {
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
provider.setApplicationContext(new ClassPathXmlApplicationContext(
|
||||
"net/sf/acegisecurity/util/filtertest-valid.xml"));
|
||||
|
||||
try {
|
||||
provider.authenticate(token);
|
||||
fail("Should have thrown CredentialsExpiredException");
|
||||
} catch (CredentialsExpiredException expected) {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void testAuthenticateFailsIfUserDisabled() {
|
||||
|
|
Loading…
Reference in New Issue