Tests: fix issue with SliceBuilderTests creation of mutated test objects

This commit is contained in:
Christoph Büscher 2016-10-24 18:48:18 +02:00
parent d4e42b77a5
commit a43f70522c
1 changed files with 2 additions and 2 deletions

View File

@ -86,7 +86,7 @@ public class SliceBuilderTests extends ESTestCase {
private static SliceBuilder randomSliceBuilder() throws IOException { private static SliceBuilder randomSliceBuilder() throws IOException {
int max = randomIntBetween(2, MAX_SLICE); int max = randomIntBetween(2, MAX_SLICE);
int id = randomInt(max - 1); int id = randomIntBetween(1, max - 1);
String field = randomAsciiOfLengthBetween(5, 20); String field = randomAsciiOfLengthBetween(5, 20);
return new SliceBuilder(field, id, max); return new SliceBuilder(field, id, max);
} }
@ -98,7 +98,7 @@ public class SliceBuilderTests extends ESTestCase {
private static SliceBuilder mutate(SliceBuilder original) throws IOException { private static SliceBuilder mutate(SliceBuilder original) throws IOException {
switch (randomIntBetween(0, 2)) { switch (randomIntBetween(0, 2)) {
case 0: return new SliceBuilder(original.getField() + "_xyz", original.getId(), original.getMax()); case 0: return new SliceBuilder(original.getField() + "_xyz", original.getId(), original.getMax());
case 1: return new SliceBuilder(original.getField(), original.getId() + 1, original.getMax()); case 1: return new SliceBuilder(original.getField(), original.getId() - 1, original.getMax());
case 2: case 2:
default: return new SliceBuilder(original.getField(), original.getId(), original.getMax() + 1); default: return new SliceBuilder(original.getField(), original.getId(), original.getMax() + 1);
} }