Skip to content

Commit cf4f6de

Browse files
committed
add a test for overloaded method of builder and List
1 parent 282a7a5 commit cf4f6de

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.elasticsearch.common.xcontent.builder;
2121

22+
import org.elasticsearch.common.collect.Lists;
2223
import org.elasticsearch.common.io.FastByteArrayOutputStream;
2324
import org.elasticsearch.common.io.FastCharArrayWriter;
2425
import org.elasticsearch.common.xcontent.XContentBuilder;
@@ -67,6 +68,12 @@ public class XContentBuilderTests {
6768
assertThat(builder.string(), equalTo("{\"test\":\"value\"}"));
6869
}
6970

71+
@Test public void testOverloadedList() throws Exception {
72+
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
73+
builder.startObject().field("test", Lists.newArrayList("1", "2")).endObject();
74+
assertThat(builder.string(), equalTo("{\"test\":[\"1\",\"2\"]}"));
75+
}
76+
7077
@Test public void testWritingBinaryToStream() throws Exception {
7178
FastByteArrayOutputStream bos = new FastByteArrayOutputStream();
7279

0 commit comments

Comments
 (0)