diff --git a/src/test/java/org/elasticsearch/action/bulk/BulkRequestTests.java b/src/test/java/org/elasticsearch/action/bulk/BulkRequestTests.java index b2242e739ee..9171fc4e424 100644 --- a/src/test/java/org/elasticsearch/action/bulk/BulkRequestTests.java +++ b/src/test/java/org/elasticsearch/action/bulk/BulkRequestTests.java @@ -20,9 +20,11 @@ package org.elasticsearch.action.bulk; import com.google.common.base.Charsets; +import org.apache.lucene.util.Constants; import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.update.UpdateRequest; +import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; @@ -36,6 +38,10 @@ public class BulkRequestTests extends ElasticsearchTestCase { @Test public void testSimpleBulk1() throws Exception { String bulkAction = copyToStringFromClasspath("/org/elasticsearch/action/bulk/simple-bulk.json"); + // translate Windows line endings (\r\n) to standard ones (\n) + if (Constants.WINDOWS) { + bulkAction = Strings.replace(bulkAction, "\r\n", "\n"); + } BulkRequest bulkRequest = new BulkRequest(); bulkRequest.add(bulkAction.getBytes(Charsets.UTF_8), 0, bulkAction.length(), true, null, null); assertThat(bulkRequest.numberOfActions(), equalTo(3));