Package dev.aherscu.qa.testing.utils
Class UrlUtils
- java.lang.Object
-
- dev.aherscu.qa.testing.utils.UrlUtils
-
public class UrlUtils extends Object
URL handling utilities.- Author:
- Adrian Herscu
-
-
Constructor Summary
Constructors Constructor Description UrlUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
hostOf(String url)
static boolean
isUrl(String url)
Checks whether specified URL is well-formed.static URL
quietlyCreateUrlFrom(String url)
Sneakily re-throws theMalformedURLException
thrown byURL(String)
.
-
-
-
Method Detail
-
hostOf
public static String hostOf(String url)
- Parameters:
url
- the URL- Returns:
- the host within specified URL
-
isUrl
public static boolean isUrl(String url)
Checks whether specified URL is well-formed.- Parameters:
url
- the URL to check- Returns:
- true if URL is well-formed, namely if
new URL(url)
does not throwMalformedURLException
-
quietlyCreateUrlFrom
public static URL quietlyCreateUrlFrom(String url)
Sneakily re-throws theMalformedURLException
thrown byURL(String)
.- Parameters:
url
- theString
to parse as a URL- Returns:
URL
-
-