From cf4f6decc49c893c767e287d68155854f8eab915 Mon Sep 17 00:00:00 2001 From: kimchy Date: Thu, 18 Nov 2010 02:25:22 +0200 Subject: [PATCH] add a test for overloaded method of builder and List --- .../common/xcontent/builder/XContentBuilderTests.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java index 3efd35b5d21..cd6c5c63314 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java @@ -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();