@Test void whenOptionalPercentIsOneHundredThenShouldGenerateValue() { assertThat(optionalRandomizer.getRandomValue()) .isEqualTo(NAME); }
@Override public T getRandomValue() { int randomPercent = random.nextInt(MAX_PERCENT); if (randomPercent <= optionalPercent) { return delegate.getRandomValue(); } return null; }
OptionalRandomizer extends AbstractRandomizer<T> { @Override public T getRandomValue() { int randomPercent = random.nextInt(MAX_PERCENT); if (randomPercent <= optionalPercent) { return delegate.getRandomValue(); } return null; } }
OptionalRandomizer extends AbstractRandomizer<T> { @Override public T getRandomValue() { int randomPercent = random.nextInt(MAX_PERCENT); if (randomPercent <= optionalPercent) { return delegate.getRandomValue(); } return null; } OptionalRandomizer(final Randomizer<T> delegate, final int optionalPercent); }
OptionalRandomizer extends AbstractRandomizer<T> { @Override public T getRandomValue() { int randomPercent = random.nextInt(MAX_PERCENT); if (randomPercent <= optionalPercent) { return delegate.getRandomValue(); } return null; } OptionalRandomizer(final Randomizer<T> delegate, final int optionalPercent); static Randomizer<T> aNewOptionalRandomizer(final Randomizer<T> delegate, final int optionalPercent); @Override T getRandomValue(); }
OptionalRandomizer extends AbstractRandomizer<T> { @Override public T getRandomValue() { int randomPercent = random.nextInt(MAX_PERCENT); if (randomPercent <= optionalPercent) { return delegate.getRandomValue(); } return null; } OptionalRandomizer(final Randomizer<T> delegate, final int optionalPercent); static Randomizer<T> aNewOptionalRandomizer(final Randomizer<T> delegate, final int optionalPercent); @Override T getRandomValue();  }