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