Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import static org.easymock.EasyMock.mock;
import static org.easymock.EasyMock.notNull;
import static org.easymock.EasyMock.reset;
import static org.hamcrest.CoreMatchers.either;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
Expand Down Expand Up @@ -439,6 +440,8 @@ public void shouldReturnUUIDsWithStringPrefix() {
final UUID uuid1 = UUID.randomUUID();
final UUID uuid2 = UUID.randomUUID();
final String prefix = uuid1.toString().substring(0, 4);
final int numMatches = uuid2.toString().substring(0, 4).equals(prefix) ? 2 : 1;

entries.add(new KeyValue<>(
new Bytes(uuidSerializer.serialize(null, uuid1)),
stringSerializer.serialize(null, "a")));
Expand All @@ -460,8 +463,12 @@ public void shouldReturnUUIDsWithStringPrefix() {
numberOfKeysReturned++;
}

assertThat(numberOfKeysReturned, is(1));
assertThat(valuesWithPrefix.get(0), is("a"));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still try to keep this assertion, something among the lines of:

if (clashOnPrefix) {
    assertThat(valuesWithPrefix.get(0), either(is("a")).or(is("b")));
} else {
    assertThat(valuesWithPrefix.get(0), is("a"));
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SG, I will do that upon merging.

assertThat(numberOfKeysReturned, is(numMatches));
if (numMatches == 2) {
assertThat(valuesWithPrefix.get(0), either(is("a")).or(is("b")));
} else {
assertThat(valuesWithPrefix.get(0), is("a"));
}
}

@Test
Expand Down