Random implements Scalar<T> { @Override public T value(final Field<T> field) { if (!this.generated.isPresent()) { this.generated = Optional.of(field.random()); } return field.actual(this.generated.get()); } Random(); @Override T value(final Field<T> field);  }
@Test public void delegatesToField() { final SpyField<Object> field = new SpyField<>(new Object(), new Object()); new Random<>().value(field); MatcherAssert.assertThat(field.calls().randomed(), Matchers.equalTo(true)); }