@Test(dataProvider = "testMaskUrlsProvider") public void testMaskCredentialsInUrl(String testName, String originalUrl, String expectedUrl) { Assert.assertEquals(UrlUtils.maskCredentialsInUrl(originalUrl), expectedUrl, "Failed masking credentials on test name: " + testName); }
public static String maskCredentialsInUrl(String lineWithCredentials) { Matcher matcher = CredentialsInUrlRegexpPattern.matcher(lineWithCredentials); if (!matcher.find()) { return lineWithCredentials; } String credentialsPart = matcher.group(); String[] split = credentialsPart.split(" return StringUtils.replace(lineWithCredentials, credentialsPart, split[0] + " }
UrlUtils { public static String maskCredentialsInUrl(String lineWithCredentials) { Matcher matcher = CredentialsInUrlRegexpPattern.matcher(lineWithCredentials); if (!matcher.find()) { return lineWithCredentials; } String credentialsPart = matcher.group(); String[] split = credentialsPart.split(" return StringUtils.replace(lineWithCredentials, credentialsPart, split[0] + " } }
UrlUtils { public static String maskCredentialsInUrl(String lineWithCredentials) { Matcher matcher = CredentialsInUrlRegexpPattern.matcher(lineWithCredentials); if (!matcher.find()) { return lineWithCredentials; } String credentialsPart = matcher.group(); String[] split = credentialsPart.split(" return StringUtils.replace(lineWithCredentials, credentialsPart, split[0] + " }  }
UrlUtils { public static String maskCredentialsInUrl(String lineWithCredentials) { Matcher matcher = CredentialsInUrlRegexpPattern.matcher(lineWithCredentials); if (!matcher.find()) { return lineWithCredentials; } String credentialsPart = matcher.group(); String[] split = credentialsPart.split(" return StringUtils.replace(lineWithCredentials, credentialsPart, split[0] + " }  static String maskCredentialsInUrl(String lineWithCredentials); }
UrlUtils { public static String maskCredentialsInUrl(String lineWithCredentials) { Matcher matcher = CredentialsInUrlRegexpPattern.matcher(lineWithCredentials); if (!matcher.find()) { return lineWithCredentials; } String credentialsPart = matcher.group(); String[] split = credentialsPart.split(" return StringUtils.replace(lineWithCredentials, credentialsPart, split[0] + " }  static String maskCredentialsInUrl(String lineWithCredentials);  }