|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.latka.validators.BaseValidator org.apache.commons.latka.validators.BaseConditionalValidator org.apache.commons.latka.validators.ResponseHeaderValidator
public class ResponseHeaderValidator
ResponseHeaderValidator validates response headers in an HTTP session. Setting just the header name tests for the existence of a header. If you set the headerValue and there is more than one header of that name, the validator matches on ANY header with that value.
Field Summary | |
---|---|
protected String |
_actualValue
|
protected boolean |
_checkValue
|
protected String |
_headerName
|
protected String |
_headerValue
|
protected static String |
BARE_MESSAGE_EQUAL_VALUES
|
protected static String |
BARE_MESSAGE_EXISTENT_HEADER
|
Fields inherited from class org.apache.commons.latka.validators.BaseConditionalValidator |
---|
_condition, _log |
Fields inherited from class org.apache.commons.latka.validators.BaseValidator |
---|
_label |
Constructor Summary | |
---|---|
ResponseHeaderValidator(String headerName)
Constructs a validator for the given header with no label. |
|
ResponseHeaderValidator(String label,
String headerName)
Constructs a labeled validator for the given header |
|
ResponseHeaderValidator(String label,
String headerName,
boolean condition)
Constructs a labeled validator for the given header |
Method Summary | |
---|---|
boolean |
assertTrue(Response response)
Checks to see that the header exists, and also checks its value if setHeaderValue(String) has been called |
String |
generateBareExceptionMessage()
The BASE exception message for a subclass of BaseConditionalValidator. |
void |
setHeaderValue(String headerValue)
Sets the desired value of the header to be validated. |
Methods inherited from class org.apache.commons.latka.validators.BaseConditionalValidator |
---|
getCondition, setCondition, throwValidationException, validate |
Methods inherited from class org.apache.commons.latka.validators.BaseValidator |
---|
fail, getLabel, setLabel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String _headerName
protected String _headerValue
protected boolean _checkValue
protected static final String BARE_MESSAGE_EXISTENT_HEADER
protected static final String BARE_MESSAGE_EQUAL_VALUES
protected String _actualValue
Constructor Detail |
---|
public ResponseHeaderValidator(String headerName)
headerName
- Name of the header to validatepublic ResponseHeaderValidator(String label, String headerName)
label
- name of the header to validateheaderName
- public ResponseHeaderValidator(String label, String headerName, boolean condition)
label
- name of the header to validateheaderName
- Method Detail |
---|
public void setHeaderValue(String headerValue)
headerValue
- desired value of the header, or null to look for a
header with the String value "null"public boolean assertTrue(Response response) throws ValidationException
assertTrue
in class BaseConditionalValidator
response
- The HTTP response to validate
ValidationException
- if the header does not meet the criteria of the testpublic String generateBareExceptionMessage()
BaseConditionalValidator
generateBareExceptionMessage
in class BaseConditionalValidator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |