RandomUidContext implements Context<Supplier<String>> { @Override public Supplier<String> getValue() { return () -> { final byte[] randomBytes = new byte[UID_RANDOM_BYTES_COUNT]; ThreadLocalRandom.current().nextBytes(randomBytes); return new BigInteger(1, randomBytes).toString(RADIX); }; }  @Override Supplier<String> getValue();  }
@Test void shouldCreateRandomUidContext() { final RandomUidContext context = new RandomUidContext(); assertThat(context.getValue()) .isNotNull(); }
@Test void shouldGenerateRandomValues() { final RandomUidContext context = new RandomUidContext(); final Supplier<String> generator = context.getValue(); final String first = generator.get(); final String second = generator.get(); assertThat(first) .isNotBlank() .isNotEqualTo(second); assertThat(second) .isNotBlank(); }