Skip to content

Commit 6f20c96

Browse files
committed
Apply feedback
1 parent bc8092b commit 6f20c96

File tree

1 file changed

+8
-5
lines changed
  • x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/config

1 file changed

+8
-5
lines changed

x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/config/ConfigTests.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import java.util.Collections;
2020
import java.util.HashMap;
21-
import java.util.List;
2221
import java.util.Map;
2322

2423
import static java.util.Collections.emptyList;
@@ -28,14 +27,18 @@
2827
public class ConfigTests extends ESTestCase {
2928

3029
public void testEmptyField() {
31-
final String field = randomBoolean() ? "" : null;
32-
Exception e = expectThrows(IllegalArgumentException.class, () -> new MetricConfig(field, singletonList("max")));
30+
Exception e = expectThrows(IllegalArgumentException.class, () -> new MetricConfig(null, singletonList("max")));
31+
assertThat(e.getMessage(), equalTo("Field must be a non-null, non-empty string"));
32+
33+
e = expectThrows(IllegalArgumentException.class, () -> new MetricConfig("", singletonList("max")));
3334
assertThat(e.getMessage(), equalTo("Field must be a non-null, non-empty string"));
3435
}
3536

3637
public void testEmptyMetrics() {
37-
final List<String> metrics = randomBoolean() ? emptyList() : null;
38-
Exception e = expectThrows(IllegalArgumentException.class, () -> new MetricConfig("foo", metrics));
38+
Exception e = expectThrows(IllegalArgumentException.class, () -> new MetricConfig("foo", emptyList()));
39+
assertThat(e.getMessage(), equalTo("Metrics must be a non-null, non-empty array of strings"));
40+
41+
e = expectThrows(IllegalArgumentException.class, () -> new MetricConfig("foo", null));
3942
assertThat(e.getMessage(), equalTo("Metrics must be a non-null, non-empty array of strings"));
4043
}
4144

0 commit comments

Comments
 (0)