Add additional assertions to IngestClientIT

This commit is contained in:
Daniel Mitterdorfer 2016-04-19 15:25:34 +02:00
parent 7cd128b372
commit 0db3eaf7d7
2 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,7 @@ import org.elasticsearch.action.DocWriteResponse;
import org.elasticsearch.action.delete.DeleteResponse; import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.action.update.UpdateResponse;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.io.stream.Streamable;
@ -173,6 +174,11 @@ public class BulkItemResponse implements Streamable, StatusToXContent {
builder.field(STATUS_FIELD, status.getStatus()); builder.field(STATUS_FIELD, status.getStatus());
return builder; return builder;
} }
@Override
public String toString() {
return Strings.toString(this);
}
} }
private int id; private int id;

View File

@ -158,6 +158,9 @@ public class IngestClientIT extends ESIntegTestCase {
assertThat(failure.getMessage(), equalTo("java.lang.IllegalArgumentException: test processor failed")); assertThat(failure.getMessage(), equalTo("java.lang.IllegalArgumentException: test processor failed"));
} else { } else {
IndexResponse indexResponse = itemResponse.getResponse(); IndexResponse indexResponse = itemResponse.getResponse();
assertThat("Expected a successful response but found failure [" + itemResponse.getFailure() + "].",
itemResponse.isFailed(), is(false));
assertThat(indexResponse, notNullValue());
assertThat(indexResponse.getId(), equalTo(Integer.toString(i))); assertThat(indexResponse.getId(), equalTo(Integer.toString(i)));
assertThat(indexResponse.isCreated(), is(true)); assertThat(indexResponse.isCreated(), is(true));
} }