T
- the type of the compared value.public abstract class ComparableSpecification<T extends Comparable<? super T>> extends Object implements Specification<T>
Comparable
.Modifier | Constructor and Description |
---|---|
protected |
ComparableSpecification(T expectedValue)
Creates a comparable specification.
|
Modifier and Type | Method and Description |
---|---|
T |
getExpectedValue()
Returns the value serving as reference in the comparison.
|
protected abstract boolean |
isExpected(int compareToResult)
Returns if the comparison result returned by
Comparable.compareTo(Object) is the one expected. |
boolean |
isSatisfiedBy(T candidate)
Evaluates if the candidate object passed as argument satisfies the specification.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
and, any, asPredicate, negate, none, or
protected ComparableSpecification(T expectedValue)
expectedValue
- the value used to do the comparison against.public boolean isSatisfiedBy(T candidate)
Specification
isSatisfiedBy
in interface Specification<T extends Comparable<? super T>>
candidate
- the candidate object to check.public T getExpectedValue()
protected abstract boolean isExpected(int compareToResult)
Comparable.compareTo(Object)
is the one expected.compareToResult
- the result returned by Comparable.compareTo(Object)
Copyright © 2013-2018–2019 SeedStack. All rights reserved.