74
74
import static org .easymock .EasyMock .mock ;
75
75
import static org .easymock .EasyMock .notNull ;
76
76
import static org .easymock .EasyMock .reset ;
77
+ import static org .hamcrest .CoreMatchers .either ;
77
78
import static org .hamcrest .CoreMatchers .equalTo ;
78
79
import static org .hamcrest .CoreMatchers .is ;
79
80
import static org .hamcrest .CoreMatchers .notNullValue ;
@@ -439,6 +440,8 @@ public void shouldReturnUUIDsWithStringPrefix() {
439
440
final UUID uuid1 = UUID .randomUUID ();
440
441
final UUID uuid2 = UUID .randomUUID ();
441
442
final String prefix = uuid1 .toString ().substring (0 , 4 );
443
+ final int numMatches = uuid2 .toString ().substring (0 , 4 ).equals (prefix ) ? 2 : 1 ;
444
+
442
445
entries .add (new KeyValue <>(
443
446
new Bytes (uuidSerializer .serialize (null , uuid1 )),
444
447
stringSerializer .serialize (null , "a" )));
@@ -460,8 +463,12 @@ public void shouldReturnUUIDsWithStringPrefix() {
460
463
numberOfKeysReturned ++;
461
464
}
462
465
463
- assertThat (numberOfKeysReturned , is (1 ));
464
- assertThat (valuesWithPrefix .get (0 ), is ("a" ));
466
+ assertThat (numberOfKeysReturned , is (numMatches ));
467
+ if (numMatches == 2 ) {
468
+ assertThat (valuesWithPrefix .get (0 ), either (is ("a" )).or (is ("b" )));
469
+ } else {
470
+ assertThat (valuesWithPrefix .get (0 ), is ("a" ));
471
+ }
465
472
}
466
473
467
474
@ Test
0 commit comments