我有用于测试基于表单的身份验证的单元测试
this.mvc.perform(formLogin("/login").user("user_login", "rusti_1993@mail.ru").password("user_password", "password")).
andExpect(
authenticated()
.withRoles(
"VISITOR"
, "ORGANIZATION_PUBLISHER"
, "ORGANIZATION_ADMIN"
, "BILITON_ADMIN"));
并抛出异常:
java.lang.AssertionError: [ROLE_VISITOR, ROLE_ORGANIZATION_PUBLISHER, ROLE_ORGANIZATION_ADMIN, ROLE_BILITON_ADMIN](db authorities) does not contain the same authorities as [ROLE_VISITOR, ROLE_ORGANIZATION_PUBLISHER, ROLE_ORGANIZATION_ADMIN, ROLE_BILITON_ADMIN]
我无法理解为什么!它们是相同的集合。我发现spring-security-test使用
java.util.Collection.containsAll(Collection c)
方法