Fix HttpExporterTemplateTests from string split

This commit fixes an issue in HttpExporterTemplateTests caused by the
migration from Strings#splitStringToArray to String#split. Namely, the
previous would split a string like "/x/y/z/" into { "x", "y", "z" } but
the former will split this into { "", "x", "y", "z" }. This commit
modifies the test logic to respond to this change.

Original commit: elastic/x-pack-elasticsearch@c567b17180
This commit is contained in:
Jason Tedor 2016-05-04 11:29:50 -04:00
parent 5b12eef2d3
commit ed26294916
1 changed files with 2 additions and 2 deletions

View File

@ -133,8 +133,8 @@ public class HttpExporterTemplateTests extends AbstractExporterTemplateTestCase
String[] paths = request.getPath().split("/"); String[] paths = request.getPath().split("/");
// Templates // Templates
if ((paths != null) && (paths.length > 0) && ("_template".equals(paths[0]))) { if ((paths != null) && (paths.length > 1) && ("_template".equals(paths[1]))) {
String templateName = paths[1]; String templateName = paths[2];
boolean templateExist = templates.containsKey(templateName); boolean templateExist = templates.containsKey(templateName);
if ("GET".equals(request.getMethod())) { if ("GET".equals(request.getMethod())) {