String text = "{sizes: length(?) == 4 : 'Number of sizes is 4'}";
assertTrue(validate(new Person(30, "Steven"), text));
}
public void testParser39InRoleRule() {
SecurityContext context = new SecurityContextImpl();
List<GrantedAuthority> roles = new ArrayList<GrantedAuthority>();
roles.add(new GrantedAuthorityImpl("ADMIN_ROLE"));
roles.add(new GrantedAuthorityImpl("USER_ROLE"));
context.setAuthentication(new TestingAuthenticationToken("username", "username", roles));
SecurityContextHolder.setContext(context);
String text = "{firstName: inRole('USER_ROLE') == true : 'Current user must be in USER_ROLE'}";
assertTrue(validate(new Person(30, "Steven"), text));
}