// expected
}
}
public void testEntityWithMultipleContentLengthAllWrong() throws Exception {
ContentLengthStrategy lenStrategy = new LaxContentLengthStrategy();
HttpMessage message = new HttpMessageMockup();
// lenient mode
message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
message.addHeader("Content-Type", "unknown");
message.addHeader("Content-Length", "yyy");
message.addHeader("Content-Length", "xxx");
assertEquals(ContentLengthStrategy.IDENTITY, lenStrategy.determineLength(message));
// strict mode
message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, true);
try {
lenStrategy.determineLength(message);
fail("ProtocolException should have been thrown");
} catch (ProtocolException ex) {
// expected
}
}