void (@NotNull String text, @Nullable String expectedExtractedUrl) { TextRange result = URLUtil.findUrl(text, 0, text.length()); if (expectedExtractedUrl == null) { assertNull("URL shouldn't be found", result); } else { assertNotNull("URL should be found", result); assertEquals("Wrong URL found", expectedExtractedUrl, result.substring(text)); assertNull("Extra URL found", URLUtil.findUrl(text, result.getEndOffset(), text.length())); } }