diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/util/Utils.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/util/Utils.java index 73a7d4ea748..f8ead9248b5 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/util/Utils.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/util/Utils.java @@ -63,6 +63,8 @@ import java.util.List; import java.util.Map; import java.util.StringJoiner; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import static org.apache.commons.lang.StringUtils.isBlank; @@ -364,31 +366,48 @@ private static List extractClaims(HttpResponse response) throws IOExcept String resultPage = rd.lines().collect(Collectors.joining()); List attributeList = new ArrayList<>(); - String claimListDiv = "
"; String labelOpenTag = "
". + + // Use a matcher to find each label within the claimString. + Matcher labelMatcher = Pattern.compile(labelOpenTag + "(.*?)" + labelCloseTag).matcher(claimString); + while (labelMatcher.find()) { + // Add the extracted label (from the 'for' attribute) to the list. + attributeList.add(labelMatcher.group(1)); } } }