Package ee.jakarta.tck.pages.common.util
Class JspTestUtil
java.lang.Object
ee.jakarta.tck.pages.common.util.JspTestUtil
JSP TCK Utility class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic boolean
Flag to enabled the printing of debug statements. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkEnumeration
(Enumeration e, String[] values) Compares the String values in an Enumeration against the provides String array of values.static void
Writes the provided message to System.out when the debug is set.static String
getAsString
(String[] sArray) Returns the provided String array in the following format: [n1,n2,n...]static String
Returns the provided Enumeration as a String in the following format: [n1,n2,n...]static String
getAsString
(Map map) Returns a String representation of theMap
provided.static String[]
static String[]
Returnes the provides Enumeration as an Array of String Arguments.static String[]
static String
getScopeName
(int scope) static String
getTagStatusAsString
(String method, String type, int status) Utility class to get a String version of a Tag return value based on the int value, the type, and the method it was returned from.static jakarta.servlet.jsp.tagext.ValidationMessage[]
getValidationMessage
(String id, String message) Creates an array of ValidationMessages.static void
handleThrowable
(Throwable t, jakarta.servlet.jsp.JspWriter out, String identifier) Utility method to handle exceptions from tests in a generic fashion.static void
invokeTest
(Object testObject, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res, jakarta.servlet.jsp.JspWriter out) Utility method to invoke JSP API Tests.
-
Field Details
-
DEBUG
public static boolean DEBUGFlag to enabled the printing of debug statements.
-
-
Method Details
-
invokeTest
public static void invokeTest(Object testObject, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res, jakarta.servlet.jsp.JspWriter out) throws jakarta.servlet.ServletException Utility method to invoke JSP API Tests.- Parameters:
testObject
- - the JSP test objectreq
- - the incoming client requestres
- - response to the clientout
- - used to write the response- Throws:
jakarta.servlet.ServletException
- - if an error occurs
-
handleThrowable
public static void handleThrowable(Throwable t, jakarta.servlet.jsp.JspWriter out, String identifier) throws IOException Utility method to handle exceptions from tests in a generic fashion.- Parameters:
t
- - offending Throwable instanceout
- - JspWriter to write the error info toidentifier
- - a test name or other logical identifier- Throws:
IOException
- if an I/O error occurs when writing to the stream.
-
checkEnumeration
Compares the String values in an Enumeration against the provides String array of values. The number of elements in the enumeration must be the same as the size of the array, or false will be returned. False will also be returned if the provided Enumeration or String array is null. If all values are found, true will be returned. The comparison is performed in a case sensitive manner.- Parameters:
e
- - Enumeration to validatevalues
- - the values expected to be found in the Enumeration- Returns:
- true if all the expected values are found, otherwise false.
-
getAsString
Returns the provided String array in the following format: [n1,n2,n...]- Parameters:
sArray
- - an array of String values- Returns:
- - a String based off the values in the array
-
getAsString
Returns the provided Enumeration as a String in the following format: [n1,n2,n...]- Parameters:
e
- - an Enumeration- Returns:
- - a printable version of the contents of the Enumeration
-
getAsStringArray
Returnes the provides Enumeration as an Array of String Arguments.- Parameters:
e
- - an Enumeration- Returns:
- - the elements of the Enumeration as an array of Strings
-
getAsStringArray
-
getAsStringArray
-
debug
Writes the provided message to System.out when the debug is set.- Parameters:
message
- - the message to write to System.out
-
getValidationMessage
public static jakarta.servlet.jsp.tagext.ValidationMessage[] getValidationMessage(String id, String message) Creates an array of ValidationMessages.- Parameters:
id
- - the jsp:idmessage
- - the error message- Returns:
- an arrary of ValidationMessages, or null if message is null.
-
getAsString
Returns a String representation of the
Map
provided.- Parameters:
map
- input map- Returns:
- String representation of the Map
-
getTagStatusAsString
Utility class to get a String version of a Tag return value based on the int value, the type, and the method it was returned from.- Parameters:
method
- - the Tag method returning the int statustype
- - the tag interface type (i.e. Tag, IterationTag)status
- - the return value from the method- Returns:
- a String representation of the information provided
-
getScopeName
-