Filters and Junit tests

Hi
I 'm implementing a custom query builder and I would like to test my
methods.
Basically I'm building a filter with "and" and "or" clause but I can't
create Junit tests because elasticsearch doesn't give me any getter methods
so I 'm not able to test if the filter I built was the one expected.
also the toString method is not implemented.
Would that be possible to get the toString method implemented or to get
getter methods in order to be able to tests filters?

--

You can use XContentBuilder to generate a query builder's
json equivalent like this:

    BaseFilterBuilder filterBuilder = andFilter(termFilter("foo", 

"bar"), termFilter("foo", "baz"));
XContentBuilder builder = XContentFactory.jsonBuilder();
filterBuilder.toXContent(builder, ToXContent.EMPTY_PARAMS);
builder.close();
String filterJson = builder.string(); // it will be
"{"and":{"filters":[{"term":{"foo":"bar"}},{"term":{"foo":"baz"}}]}}"

On Tuesday, December 4, 2012 7:44:58 AM UTC-5, Tatiana wrote:

Hi
I 'm implementing a custom query builder and I would like to test my
methods.
Basically I'm building a filter with "and" and "or" clause but I can't
create Junit tests because elasticsearch doesn't give me any getter methods
so I 'm not able to test if the filter I built was the one expected.
also the toString method is not implemented.
Would that be possible to get the toString method implemented or to get
getter methods in order to be able to tests filters?

--