From 45fb3db062f862fa96e8d7c92833a42b1e369793 Mon Sep 17 00:00:00 2001 From: Alexander Reelsen Date: Fri, 23 Feb 2018 09:10:56 +0100 Subject: [PATCH] Tests: Fix JiraIssueTests to not hide secrets Original commit: elastic/x-pack-elasticsearch@f4c83c2da3a5afaaa566042ae8f51384d28271ea --- .../watcher/notification/jira/JiraIssueTests.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/notification/jira/JiraIssueTests.java b/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/notification/jira/JiraIssueTests.java index 2823faa17b2..8e615d76050 100644 --- a/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/notification/jira/JiraIssueTests.java +++ b/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/notification/jira/JiraIssueTests.java @@ -7,10 +7,10 @@ package org.elasticsearch.xpack.watcher.notification.jira; import org.apache.http.HttpStatus; import org.elasticsearch.common.collect.Tuple; -import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; +import org.elasticsearch.xpack.core.watcher.support.xcontent.WatcherParams; import org.elasticsearch.xpack.watcher.common.http.HttpMethod; import org.elasticsearch.xpack.watcher.common.http.HttpRequest; import org.elasticsearch.xpack.watcher.common.http.HttpResponse; @@ -18,7 +18,6 @@ import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuthFactory; -import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -40,7 +39,7 @@ public class JiraIssueTests extends ESTestCase { final JiraIssue issue = randomJiraIssue(); try (XContentBuilder builder = randomFrom(jsonBuilder(), smileBuilder(), yamlBuilder(), cborBuilder())) { - issue.toXContent(builder, ToXContent.EMPTY_PARAMS); + issue.toXContent(builder, WatcherParams.builder().hideSecrets(false).build()); Map parsedFields = null; Map parsedResult = null; @@ -81,7 +80,6 @@ public class JiraIssueTests extends ESTestCase { } } - assertThat(parsedAccount, equalTo(issue.getAccount())); assertThat(parsedFields, equalTo(issue.getFields())); if (issue.successful()) { @@ -96,7 +94,7 @@ public class JiraIssueTests extends ESTestCase { } } - public void testEquals() throws Exception { + public void testEquals() { final JiraIssue issue1 = randomJiraIssue(); final boolean equals = randomBoolean(); @@ -113,7 +111,7 @@ public class JiraIssueTests extends ESTestCase { assertThat(issue1.equals(issue2), is(equals)); } - private static JiraIssue randomJiraIssue() throws IOException { + private static JiraIssue randomJiraIssue() { String account = "account_" + randomIntBetween(0, 100); Map fields = randomIssueDefaults(); HttpRequest request = HttpRequest.builder(randomFrom("localhost", "internal-jira.elastic.co"), randomFrom(80, 443))