@Test
public void testGetSecurityRules() throws Exception {

	long userId = createUser("user1", Role.USER, "password");
	User user = new User();
	user.setId(userId);
	
	long groupId = createGroup("group1");
	UserGroup group = new UserGroup();
	group.setId(groupId);
	
	List<SecurityRule> rules = new ArrayList<>();
	
	SecurityRule rule = new SecurityRule();
	rule.setUser(user);
	rule.setCanRead(true);
	rules.add(rule);
	
	rule = new SecurityRule();
	rule.setCanRead(true);
	rule.setCanWrite(true);
	rule.setGroup(group);
	rules.add(rule);
	
	long resourceId = createResource("name1", "description1", "MAP", rules);
	
	List<SecurityRule> writtenRules = resourceService.getSecurityRules(resourceId);
	
	assertEquals(2, writtenRules.size());
	
	SecurityRule userRule = writtenRules.get(0);
sertNotNull(userRule.getUser());
	assertNull(userRule.getGroup());
	assertEquals((Long)userId, userRule.getUser().getId());
	assertEquals((Long)resourceId, userRule.getResource().getId());
	
	SecurityRule groupRule = writtenRules.get(1);
sertNotNull(groupRule.getGroup());
	assertNull(groupRule.getUser());
	assertEquals((Long)groupId, groupRule.getGroup().getId());
	assertEquals((Long)resourceId, groupRule.getResource().getId());
	
}