Between extends OrderedScalar<T> { @Override public T value(final OrderedField<T> field) { if (!this.generated.isPresent()) { this.generated = Optional.of( field.between(this.lower, this.greater) ); } return field.actual(this.generated.get()); } Between(final Scalar<T> lower, final Scalar<T> greater); @Override T value(final OrderedField<T> field);  }
@Test public void betweenThrowsExceptionWhenUnorderedField() { this.thrown.expect(UnsupportedOperationException.class); new Between<>( new Scalar.Default<>(new Object()), new Scalar.Default<>(new Object()) ).value(new SpyField<>(new Object(), new Object())); }