test: increased logging for http and improved assertion failure

Original commit: elastic/x-pack-elasticsearch@e41901f5c8
This commit is contained in:
Martijn van Groningen 2015-09-14 14:19:30 +02:00
parent 96b5558966
commit 2ec09c140e
1 changed files with 5 additions and 3 deletions

View File

@ -8,6 +8,7 @@ package org.elasticsearch.watcher.actions.hipchat.service;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.test.junit.annotations.Network;
import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.watcher.actions.hipchat.HipChatAction;
import org.elasticsearch.watcher.test.AbstractWatcherIntegrationTestCase;
import org.elasticsearch.watcher.transport.actions.put.PutWatchResponse;
@ -28,6 +29,7 @@ import static org.hamcrest.Matchers.*;
*
*/
@Network
@TestLogging("watcher.support.http:TRACE")
public class HipChatServiceTests extends AbstractWatcherIntegrationTestCase {
@Override
@ -77,7 +79,7 @@ public class HipChatServiceTests extends AbstractWatcherIntegrationTestCase {
SentMessages messages = account.send(hipChatMessage);
assertThat(messages.count(), is(2));
for (SentMessages.SentMessage message : messages) {
assertThat(message.successful(), is(true));
assertThat("Expected no failures, but got [" + message.failureReason + "]", message.successful(), is(true));
assertThat(message.request, notNullValue());
assertThat(message.response, notNullValue());
assertThat(message.response.status(), lessThan(300));
@ -101,7 +103,7 @@ public class HipChatServiceTests extends AbstractWatcherIntegrationTestCase {
SentMessages messages = account.send(hipChatMessage);
assertThat(messages.count(), is(1));
for (SentMessages.SentMessage message : messages) {
assertThat(message.successful(), is(true));
assertThat("Expected no failures, but got [" + message.failureReason + "]", message.successful(), is(true));
assertThat(message.request, notNullValue());
assertThat(message.response, notNullValue());
assertThat(message.response.status(), lessThan(300));
@ -125,7 +127,7 @@ public class HipChatServiceTests extends AbstractWatcherIntegrationTestCase {
SentMessages messages = account.send(hipChatMessage);
assertThat(messages.count(), is(3));
for (SentMessages.SentMessage message : messages) {
assertThat(message.successful(), is(true));
assertThat("Expected no failures, but got [" + message.failureReason + "]", message.successful(), is(true));
assertThat(message.request, notNullValue());
assertThat(message.response, notNullValue());
assertThat(message.response.status(), lessThan(300));