Package com.xceptance.xlt.api.util
Class BasicPageUtils
java.lang.Object
com.xceptance.xlt.api.util.BasicPageUtils
- Direct Known Subclasses:
HtmlPageUtils
,LightweightHtmlPageUtils
The
BasicPageUtils
class provides common helper methods for its child classes. It is not meant to be used
directly.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getAbsoluteUrl
(String baseUrl, String relativePath) Returns an absolute URL built from the passed base URL and relative path.static String
getAbsoluteUrl
(URL baseUrl, String relativePath) Returns an absolute URL built from the passed base URL and relative path.static <T> T
pickOneRandomly
(List<T> elements) Returns one entry from the passed list, chosen randomly.static <T> T
pickOneRandomly
(List<T> elements, boolean excludeFirst) Returns one entry from the passed list, chosen randomly.static <T> T
pickOneRandomly
(List<T> elements, boolean excludeFirst, boolean excludeLast) Returns one entry from the passed list, chosen randomly.
-
Constructor Details
-
BasicPageUtils
public BasicPageUtils()
-
-
Method Details
-
getAbsoluteUrl
public static String getAbsoluteUrl(String baseUrl, String relativePath) throws MalformedURLException Returns an absolute URL built from the passed base URL and relative path.- Parameters:
baseUrl
- the base URL as a stringrelativePath
- the relative path- Returns:
- the new absolute URL
- Throws:
MalformedURLException
- if the new URL is invalid
-
getAbsoluteUrl
Returns an absolute URL built from the passed base URL and relative path.- Parameters:
baseUrl
- the base URLrelativePath
- the relative path- Returns:
- the new absolute URL
- Throws:
MalformedURLException
- if the new URL is invalid
-
pickOneRandomly
Returns one entry from the passed list, chosen randomly.- Type Parameters:
T
- the type of the elements in the list- Parameters:
elements
- the list- Returns:
- one element from the list
-
pickOneRandomly
Returns one entry from the passed list, chosen randomly. It can be specified whether or not the first entry is to be ignored.- Type Parameters:
T
- the type of the elements in the list- Parameters:
elements
- the listexcludeFirst
- whether or not the first entry is to be excluded- Returns:
- one element from the list
-
pickOneRandomly
Returns one entry from the passed list, chosen randomly. It can be specified whether or not the first and/or the last entries are to be ignored.- Type Parameters:
T
- the type of the elements in the list- Parameters:
elements
- the listexcludeFirst
- whether or not the first entry is to be excludedexcludeLast
- whether or not the last entry is to be excluded- Returns:
- one element from the list
-