diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/notification/jira/JiraIssueTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/notification/jira/JiraIssueTests.java index 43b08b34b6b..4046aac7de2 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/notification/jira/JiraIssueTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/notification/jira/JiraIssueTests.java @@ -99,8 +99,11 @@ public class JiraIssueTests extends ESTestCase { final Map fields = new HashMap<>(issue1.getFields()); if (equals == false) { - String key = randomFrom(fields.keySet()); - fields.remove(key); + if (fields.isEmpty()) { + fields.put(randomAsciiOfLength(5), randomAsciiOfLength(10)); + } else { + fields.remove(randomFrom(fields.keySet())); + } } JiraIssue issue2 = new JiraIssue(fields, issue1.getRequest(), issue1.getResponse(), issue1.getFailureReason());