Add implements Scalar<T> { public Iterable<Scalar<T>> operands() { return this.opers; } Add(final Iterable<? extends Scalar<T>> operands);  Add(final Scalar<T> first, final Scalar<T> second); Iterable<Scalar<T>> operands(); @Override T value(final Field<T> field);  }
@Test public void exposesOperands() { final Scalar<Object> first = new Scalar.Default<>(new Object()); final Scalar<Object> second = new Scalar.Default<>(new Object()); final List<Scalar<Object>> operands = Lists.newArrayList( new Add<>(first, second).operands() ); MatcherAssert.assertThat( operands.contains(first), Matchers.equalTo(true) ); MatcherAssert.assertThat( operands.contains(second), Matchers.equalTo(true) ); }