diff --git a/streams/src/test/java/org/apache/kafka/streams/state/internals/RocksDBStoreTest.java b/streams/src/test/java/org/apache/kafka/streams/state/internals/RocksDBStoreTest.java index 93e65f02ebddb..c9e9a8d94692c 100644 --- a/streams/src/test/java/org/apache/kafka/streams/state/internals/RocksDBStoreTest.java +++ b/streams/src/test/java/org/apache/kafka/streams/state/internals/RocksDBStoreTest.java @@ -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; @@ -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"))); @@ -460,8 +463,12 @@ public void shouldReturnUUIDsWithStringPrefix() { numberOfKeysReturned++; } - assertThat(numberOfKeysReturned, is(1)); - assertThat(valuesWithPrefix.get(0), is("a")); + 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