[Test] Fix BulkResponseTests

This commit is contained in:
Tanguy Leroux 2017-03-03 09:34:10 +01:00
parent 8e09eca9a6
commit 1ceb6d04c7
1 changed files with 7 additions and 2 deletions

View File

@ -20,6 +20,7 @@
package org.elasticsearch.action.bulk;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.action.DocWriteRequest;
import org.elasticsearch.action.DocWriteResponse;
import org.elasticsearch.action.delete.DeleteResponseTests;
@ -75,8 +76,12 @@ public class BulkResponseTests extends ESTestCase {
String id = randomAsciiOfLength(5);
Tuple<Throwable, ElasticsearchException> failures = randomExceptions();
bulkItems[i] = new BulkItemResponse(i, opType, new BulkItemResponse.Failure(index, type, id, (Exception) failures.v1()));
expectedBulkItems[i] = new BulkItemResponse(i, opType, new BulkItemResponse.Failure(index, type, id, failures.v2()));
Exception bulkItemCause = (Exception) failures.v1();
bulkItems[i] = new BulkItemResponse(i, opType,
new BulkItemResponse.Failure(index, type, id, bulkItemCause));
expectedBulkItems[i] = new BulkItemResponse(i, opType,
new BulkItemResponse.Failure(index, type, id, failures.v2(), ExceptionsHelper.status(bulkItemCause)));
}
}