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