1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.acegisecurity.event.authentication;
17
18 import junit.framework.TestCase;
19
20 import org.acegisecurity.Authentication;
21 import org.acegisecurity.LockedException;
22 import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
23
24
25 /***
26 * Tests {@link LoggerListener}.
27 *
28 * @author Ben Alex
29 * @version $Id: LoggerListenerTests.java,v 1.2 2005/11/17 00:56:47 benalex Exp $
30 */
31 public class LoggerListenerTests extends TestCase {
32
33
34 public final void setUp() throws Exception {
35 super.setUp();
36 }
37
38 public static void main(String[] args) {
39 junit.textui.TestRunner.run(LoggerListenerTests.class);
40 }
41
42 public void testLogsEvents() {
43 AuthenticationFailureDisabledEvent event = new AuthenticationFailureDisabledEvent(getAuthentication(),
44 new LockedException("TEST"));
45 LoggerListener listener = new LoggerListener();
46 listener.onApplicationEvent(event);
47 assertTrue(true);
48 }
49
50 private Authentication getAuthentication() {
51 UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken("Principal",
52 "Credentials");
53 authentication.setDetails("127.0.0.1");
54
55 return authentication;
56 }
57 }