*/
@Test
public void testProcessHttpException() {
final InputStream inStream = this.getClass().getClassLoader()
.getResourceAsStream("dummyData.xml");
final Context context = new StandardContext();
final Command com = new URLMatchCommand(null);
try {
context.setSource(new InputStreamReader(inStream, "UTF-8"));
com.process(context);
} catch (final ConfigurationException e1) {
fail("ConfigurationException thrown while waiting for HttpException");
LOGGER.error("Error occured in testProcess:", e1);
} catch (final UnsupportedEncodingException e) {
fail("Wrong Encoding thrown while waiting for HttpException");
LOGGER.error("Error occured in testProcess:", e);
}
CheckUrlsCommand command;
final HttpClient client = createNiceMock(HttpClient.class);
try {
expect(client.executeMethod(isA(HttpMethod.class))).andThrow(
new HttpException()).anyTimes();
expect(client.getHttpConnectionManager()).andReturn(
new MultiThreadedHttpConnectionManager()).anyTimes();
replay(client);
command = new CheckUrlsCommand(null, client);
command.process(context);
assertEquals(14, context.getResults().size());
assertNull(CollectionUtils.find(context.getResults(),
new Predicate() {
public boolean evaluate(final Object object) {
final Result r = (Result) object;
return r.isValid();