diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/Assert.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/Assert.java index 3ca2a16b07..4c98aba945 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/Assert.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/Assert.java @@ -36,7 +36,10 @@ import java.util.Map; import java.util.Set; import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; +import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.lessThanOrEqualTo; /** @@ -145,4 +148,11 @@ public class Assert extends org.junit.Assert { org.junit.Assert.assertThat(actual, allOf(greaterThanOrEqualTo(expected - 50), lessThanOrEqualTo(expected))); } + public static void assertRoleAttributes(Map> expected, Map> actual) { + assertThat(actual.keySet(), equalTo(expected.keySet())); + for (String expectedKey : expected.keySet()) { + assertThat(actual.get(expectedKey).size(), is(equalTo(expected.get(expectedKey).size()))); + assertThat(actual.get(expectedKey), containsInAnyOrder(expected.get(expectedKey).toArray())); + } + } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/RoleByIdResourceTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/RoleByIdResourceTest.java index 42122521b4..a277e78fde 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/RoleByIdResourceTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/RoleByIdResourceTest.java @@ -176,7 +176,7 @@ public class RoleByIdResourceTest extends AbstractAdminTest { Map> roleAttributes = role.getAttributes(); assertNotNull(roleAttributes); - assertEquals(attributes, roleAttributes); + Assert.assertRoleAttributes(attributes, roleAttributes); // delete an attribute @@ -188,7 +188,7 @@ public class RoleByIdResourceTest extends AbstractAdminTest { roleAttributes = role.getAttributes(); assertNotNull(roleAttributes); - assertEquals(attributes, roleAttributes); + Assert.assertRoleAttributes(attributes, roleAttributes); } } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/exportimport/ExportImportTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/exportimport/ExportImportTest.java index 4a076d021d..5ae6fb3e69 100755 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/exportimport/ExportImportTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/exportimport/ExportImportTest.java @@ -311,7 +311,7 @@ public class ExportImportTest extends AbstractKeycloakTest { assertEquals(sampleRealmRoleId, importedSampleRealmRoleId); Map> importedRoleAttributes = adminClient.realm("test").roles().get("attribute-role").toRepresentation().getAttributes(); - assertEquals(roleAttributes, importedRoleAttributes); + Assert.assertRoleAttributes(roleAttributes, importedRoleAttributes); String importedSampleClientRoleId = adminClient.realm("test").clients().get(testAppId).roles().get("sample-client-role").toRepresentation().getId(); assertEquals(sampleClientRoleId, importedSampleClientRoleId);