Change use of generics in test

Original commit: elastic/x-pack-elasticsearch@39473681b2
This commit is contained in:
Chris Earle 2016-08-17 15:50:20 -04:00
parent c16860e901
commit 572869087d
1 changed files with 7 additions and 4 deletions

View File

@ -15,18 +15,21 @@ import org.elasticsearch.script.ScriptService.ScriptType;
import org.elasticsearch.test.ESTestCase;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import static java.util.Collections.emptyMap;
import static java.util.Collections.singletonMap;
import static org.hamcrest.Matchers.equalTo;
public class WatcherScriptTests extends ESTestCase {
public void testParseScript() throws IOException {
final Map<String, Object> params =
randomFrom(Collections.<String, Object>emptyMap(), Collections.singletonMap("foo", (Object)"bar"), null);
WatcherScript script = new WatcherScript(randomAsciiOfLengthBetween(1, 5),
randomFrom(ScriptType.values()),
randomBoolean() ? null : randomFrom("custom", "mustache"),
randomBoolean() ? null : randomFrom(emptyMap(), singletonMap("foo", "bar")));
randomFrom("custom", "mustache", null),
params);
try (XContentParser parser = createParser(script)) {
assertThat(WatcherScript.parse(parser), equalTo(script));