This is an automated email from the ASF dual-hosted git repository. buhhunyx pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git
commit 22140022cba22bfcae1709d1250ef408e53d3d34 Author: Alexey Markevich <buhhu...@gmail.com> AuthorDate: Thu Nov 4 10:14:48 2021 +0300 fediz-systests-oidc: fix pmd warning --- .../cxf/fediz/systests/oidc/AbstractOIDCTest.java | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/AbstractOIDCTest.java b/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/AbstractOIDCTest.java index 3513cdd..70e23f9 100644 --- a/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/AbstractOIDCTest.java +++ b/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/AbstractOIDCTest.java @@ -264,8 +264,8 @@ abstract class AbstractOIDCTest { private static String getClientIdByName(String clientName, HtmlPage registeredClientsPage) { final HtmlTable table = registeredClientsPage.getHtmlElementById("registered_clients"); for (final HtmlTableRow row : table.getRows()) { - if (clientName.equals(row.getCell(0).asText())) { - final String clientId = row.getCell(1).asText(); + if (clientName.equals(row.getCell(0).asNormalizedText())) { + final String clientId = row.getCell(1).asNormalizedText(); assertNotNull(clientId); return clientId; } @@ -275,8 +275,8 @@ abstract class AbstractOIDCTest { private static String getClientSecret(final HtmlPage registeredClientPage, String clientId) throws IOException { final HtmlTable table = registeredClientPage.getHtmlElementById("client"); - assertEquals(clientId, table.getCellAt(1, 0).asText()); - return table.getCellAt(1, 2).asText(); + assertEquals(clientId, table.getCellAt(1, 0).asNormalizedText()); + return table.getCellAt(1, 2).asNormalizedText(); } private static HtmlPage registerConfidentialClient(HtmlPage registerPage, @@ -319,9 +319,9 @@ abstract class AbstractOIDCTest { // Get the client identifier HtmlTable table = registeredClientsPage.getHtmlElementById("registered_clients"); - String clientId = table.getCellAt(1, 1).asText(); + String clientId = table.getCellAt(1, 1).asNormalizedText(); assertNotNull(clientId); - String clientId2 = table.getCellAt(2, 1).asText(); + String clientId2 = table.getCellAt(2, 1).asNormalizedText(); assertNotNull(clientId2); // Now go to the specific client page @@ -367,18 +367,18 @@ abstract class AbstractOIDCTest { assertEquals(table.getRows().size(), 3); // Now check the first client - String clientId = table.getCellAt(1, 1).asText(); + String clientId = table.getCellAt(1, 1).asNormalizedText(); assertNotNull(clientId); // Check the Date - String date = table.getCellAt(1, 2).asText(); + String date = table.getCellAt(1, 2).asNormalizedText(); SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM yyyy", Locale.US); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); assertEquals(dateFormat.format(new Date()), date); // Check the redirect URI - String redirectURI = table.getCellAt(1, 3).asText().trim(); // <br/> - assertTrue(REDIRECT_URL.equals(redirectURI)); + String redirectURI = table.getCellAt(1, 3).asNormalizedText().trim(); // <br/> + assertEquals(REDIRECT_URL, redirectURI); } } @@ -414,7 +414,7 @@ abstract class AbstractOIDCTest { assertEquals("2 clients", table.getRows().size(), 3); boolean updatedClientFound = false; for (final HtmlTableRow row : table.getRows()) { - if (newClientName.equals(row.getCell(0).asText())) { + if (newClientName.equals(row.getCell(0).asNormalizedText())) { updatedClientFound = true; break; } @@ -539,7 +539,7 @@ abstract class AbstractOIDCTest { // Now try to register a new client HtmlPage errorPage = registerConfidentialClient(registerPage, "asfxyz", "https://127.0.0.1//", "https://cxf.apache.org", "https://localhost:12345"); - assertTrue(errorPage.asText().contains("Invalid Client Registration")); + assertTrue(errorPage.asNormalizedText().contains("Invalid Client Registration")); } } @@ -552,7 +552,7 @@ abstract class AbstractOIDCTest { // Now try to register a new client HtmlPage errorPage = registerConfidentialClient(registerPage, "asfxyz", "https://127.0.0.1#fragment", "https://cxf.apache.org", "https://localhost:12345"); - assertTrue(errorPage.asText().contains("Invalid Client Registration")); + assertTrue(errorPage.asNormalizedText().contains("Invalid Client Registration")); } } @@ -565,7 +565,7 @@ abstract class AbstractOIDCTest { // Now try to register a new client HtmlPage errorPage = registerConfidentialClient(registerPage, "asfxyz", "https://127.0.0.1/", "https://cxf.apache.org//", "https://localhost:12345"); - assertTrue(errorPage.asText().contains("Invalid Client Registration")); + assertTrue(errorPage.asNormalizedText().contains("Invalid Client Registration")); } } @@ -578,7 +578,7 @@ abstract class AbstractOIDCTest { // Now try to register a new client HtmlPage errorPage = registerConfidentialClient(registerPage, "asfxyz", "https://127.0.0.1/", "https://cxf.apache.org/", "https://localhost:12345//"); - assertTrue(errorPage.asText().contains("Invalid Client Registration")); + assertTrue(errorPage.asNormalizedText().contains("Invalid Client Registration")); } } @@ -591,7 +591,7 @@ abstract class AbstractOIDCTest { // Now try to register a new client HtmlPage errorPage = registerConfidentialClient(registerPage, "asfxyz", "https://127.0.0.1", "https://cxf.apache.org#fragment", "https://localhost:12345"); - assertTrue(errorPage.asText().contains("Invalid Client Registration")); + assertTrue(errorPage.asNormalizedText().contains("Invalid Client Registration")); } } @@ -630,7 +630,7 @@ abstract class AbstractOIDCTest { // Register a client with an unsupported TLD HtmlPage errorPage = registerConfidentialClient(registerPage, "tld2", "https://www.apache.corp2", "https://cxf.apache.org", "https://localhost:12345"); - assertTrue(errorPage.asText().contains("Invalid Client Registration")); + assertTrue(errorPage.asNormalizedText().contains("Invalid Client Registration")); // Delete the first client above deleteClient(webClient.getPage(clientsUrl.resolveTemplate("path", clientId).build().toURL()));