Validate extends GenericResultAbstractAction { @Override public String getRestMethodName() { return "POST"; } protected  Validate(Builder builder); @Override String getRestMethodName(); @Override String getPathToResult();  }
@Test public void validateQuery() { Validate validate = new Validate.Builder("{query:query}").build(); assertEquals("POST", validate.getRestMethodName()); assertEquals("{query:query}", validate.getData(null)); assertEquals("/_validate/query", validate.getURI(ElasticsearchVersion.UNKNOWN)); }
@Test public void validateQueryWithIndex() { Validate validate = new Validate.Builder("{query:query}").index("twitter").build(); assertEquals("POST", validate.getRestMethodName()); assertEquals("{query:query}", validate.getData(null)); assertEquals("twitter/_validate/query", validate.getURI(ElasticsearchVersion.UNKNOWN)); }
@Test public void validateQueryWithIndexAndType() { Validate validate = new Validate.Builder("{query:query}").index("twitter").type("tweet").build(); assertEquals("POST", validate.getRestMethodName()); assertEquals("{query:query}", validate.getData(null)); assertEquals("twitter/tweet/_validate/query", validate.getURI(ElasticsearchVersion.UNKNOWN)); }