add a test for overloaded method of builder and List
This commit is contained in:
parent
282a7a5162
commit
cf4f6decc4
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.elasticsearch.common.xcontent.builder;
|
||||
|
||||
import org.elasticsearch.common.collect.Lists;
|
||||
import org.elasticsearch.common.io.FastByteArrayOutputStream;
|
||||
import org.elasticsearch.common.io.FastCharArrayWriter;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
@ -67,6 +68,12 @@ public class XContentBuilderTests {
|
|||
assertThat(builder.string(), equalTo("{\"test\":\"value\"}"));
|
||||
}
|
||||
|
||||
@Test public void testOverloadedList() throws Exception {
|
||||
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
|
||||
builder.startObject().field("test", Lists.newArrayList("1", "2")).endObject();
|
||||
assertThat(builder.string(), equalTo("{\"test\":[\"1\",\"2\"]}"));
|
||||
}
|
||||
|
||||
@Test public void testWritingBinaryToStream() throws Exception {
|
||||
FastByteArrayOutputStream bos = new FastByteArrayOutputStream();
|
||||
|
||||
|
|
Loading…
Reference in New Issue