[TEST] Fix JiraIssueTests.testEquals()

This commit fixes a test bug were a random field is picked out of an empty collection.

Original commit: elastic/x-pack-elasticsearch@a42dff7257
This commit is contained in:
Tanguy Leroux 2016-11-22 09:09:44 +01:00
parent 158ab2e724
commit 4978d3a8e0
1 changed files with 5 additions and 2 deletions

View File

@ -99,8 +99,11 @@ public class JiraIssueTests extends ESTestCase {
final Map<String, Object> fields = new HashMap<>(issue1.getFields()); final Map<String, Object> fields = new HashMap<>(issue1.getFields());
if (equals == false) { if (equals == false) {
String key = randomFrom(fields.keySet()); if (fields.isEmpty()) {
fields.remove(key); fields.put(randomAsciiOfLength(5), randomAsciiOfLength(10));
} else {
fields.remove(randomFrom(fields.keySet()));
}
} }
JiraIssue issue2 = new JiraIssue(fields, issue1.getRequest(), issue1.getResponse(), issue1.getFailureReason()); JiraIssue issue2 = new JiraIssue(fields, issue1.getRequest(), issue1.getResponse(), issue1.getFailureReason());