PageRenderTime 19ms CodeModel.GetById 15ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/web/DRCP/test/com/bluesky/drcp/business/service/UserRoleServiceTest.java

http://drcp.googlecode.com/
Java | 34 lines | 25 code | 9 blank | 0 comment | 1 complexity | 818a26f175ccbb8298fb90680123e88b MD5 | raw file
 1package com.bluesky.drcp.business.service;
 2
 3import java.util.ArrayList;
 4import java.util.List;
 5
 6import junit.framework.TestCase;
 7import util.ApplicationContextUtil;
 8
 9public class UserRoleServiceTest extends TestCase {
10	private UserRoleService svc;
11
12	protected void setUp() throws Exception {
13		super.setUp();
14		svc = (UserRoleService) ApplicationContextUtil.getFactory().getBean(
15				"userRoleService");
16	}
17
18	public void testIsAdmin() {
19		assertTrue(svc.isAdmin("admin"));
20		assertFalse(svc.isAdmin("jack"));
21	}
22
23	public void testAccessRoleList(){
24		List roleIds = new ArrayList();
25		roleIds.add("admin1");
26		roleIds.add("admin2");
27		
28		svc.setRoleList("jack", roleIds);
29		
30		List roleIds2 = svc.getRoleList("jack");
31		
32		assertTrue(roleIds2.size() == roleIds.size());
33	}
34}