final String headerBaseName = "invalidName";
final String headerValue = "testValue";
for (char i = 0; i <= 31; i++)
{
final RestResponseBuilder builder = new RestResponseBuilder();
try
{
builder.setHeader(headerBaseName + i, headerValue);
Assert.fail("Should have thrown exception for invalid char (control char): " + i);
}
catch (IllegalArgumentException e)
{
// expected
}
}
for (char i = 127; i <= 255; i++)
{
final RestResponseBuilder builder = new RestResponseBuilder();
try
{
builder.setHeader(headerBaseName + i, headerValue);
Assert.fail("Should have thrown exception for invalid char (control char): " + i);
}
catch (IllegalArgumentException e)
{
// expected