1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.acegisecurity.providers.dao.cache;
17
18 import junit.framework.TestCase;
19
20 import org.acegisecurity.GrantedAuthority;
21 import org.acegisecurity.GrantedAuthorityImpl;
22 import org.acegisecurity.userdetails.User;
23
24
25 /***
26 * Tests {@link NullUserCache}.
27 *
28 * @author Ben Alex
29 * @version $Id: NullUserCacheTests.java,v 1.6 2005/11/29 13:10:09 benalex Exp $
30 */
31 public class NullUserCacheTests extends TestCase {
32
33
34 public NullUserCacheTests() {
35 super();
36 }
37
38 public NullUserCacheTests(String arg0) {
39 super(arg0);
40 }
41
42
43
44 public final void setUp() throws Exception {
45 super.setUp();
46 }
47
48 public static void main(String[] args) {
49 junit.textui.TestRunner.run(NullUserCacheTests.class);
50 }
51
52 public void testCacheOperation() throws Exception {
53 NullUserCache cache = new NullUserCache();
54 cache.putUserInCache(getUser());
55 assertNull(cache.getUserFromCache(null));
56 cache.removeUserFromCache(null);
57 }
58
59 private User getUser() {
60 return new User("john", "password", true, true, true, true,
61 new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_ONE"), new GrantedAuthorityImpl(
62 "ROLE_TWO")});
63 }
64 }