diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractAdapterTest.java index 11c17f0cd8..3fffb24768 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractAdapterTest.java @@ -95,28 +95,32 @@ public abstract class AbstractAdapterTest extends AbstractAuthTest { } protected void modifyClientWebOrigins(RealmRepresentation realm, String regex, String replacement) { - for (ClientRepresentation client : realm.getClients()) { - List webOrigins = client.getWebOrigins(); - if (webOrigins != null) { - List newWebOrigins = new ArrayList<>(); - for (String uri : webOrigins) { - newWebOrigins.add(uri.replaceAll(regex, replacement)); + if (realm.getClients() != null) { + for (ClientRepresentation client : realm.getClients()) { + List webOrigins = client.getWebOrigins(); + if (webOrigins != null) { + List newWebOrigins = new ArrayList<>(); + for (String uri : webOrigins) { + newWebOrigins.add(uri.replaceAll(regex, replacement)); + } + client.setWebOrigins(newWebOrigins); } - client.setWebOrigins(newWebOrigins); } } } protected void modifySamlMasterURLs(RealmRepresentation realm, String regex, String replacement) { - for (ClientRepresentation client : realm.getClients()) { - if (client.getProtocol() != null && client.getProtocol().equals("saml")) { - log.info("Modifying master URL of SAML client: " + client.getClientId()); - String masterUrl = client.getAdminUrl(); - if (masterUrl == null) { - masterUrl = client.getBaseUrl(); + if (realm.getClients() != null) { + for (ClientRepresentation client : realm.getClients()) { + if (client.getProtocol() != null && client.getProtocol().equals("saml")) { + log.info("Modifying master URL of SAML client: " + client.getClientId()); + String masterUrl = client.getAdminUrl(); + if (masterUrl == null) { + masterUrl = client.getBaseUrl(); + } + masterUrl = masterUrl.replaceFirst(regex, replacement); + client.setAdminUrl(masterUrl); } - masterUrl = masterUrl.replaceFirst(regex, replacement); - client.setAdminUrl(masterUrl); } } }