Package org.meeuw.theories
Interface BasicObjectTheory<E>
- All Known Subinterfaces:
AbelianRingTheory<E>,AdditiveAbelianGroupTheory<E>,AdditiveAbelianSemiGroupTheory<E>,AdditiveGroupTheory<E>,AdditiveMonoidTheory<E>,AdditiveSemiGroupTheory<E>,AlgebraicStructureTheory<E>,ComparableTheory<E>,CompleteFieldTheory<E>,CompleteScalarFieldTheory<E>,DivisibleGroupTheory<E>,DivisionRingTheory<E>,ElementTheory<E>,FieldTheory<E>,GroupTheory<E>,MagmaTheory<E>,MetricSpaceTheory<E,,S> MultiplicativeAbelianGroupTheory<E>,MultiplicativeAbelianSemiGroupTheory<E>,MultiplicativeGroupTheory<E>,MultiplicativeMonoidTheory<E>,MultiplicativeSemiGroupTheory<E>,OrderedTheory<E>,RingTheory<E>,RngTheory<E>,ScalarFieldTheory<E>,ScalarTheory<S>,SignedNumberTheory<E>,SizeableScalarTheory<S,,SIZE> SizeableTheory<E,,SIZE> StrictlyOrderedTheory<E>,UncertainDoubleTheory<E>,VectorSpaceTheory<V,,S> WithScalarTheory<E,S>
public interface BasicObjectTheory<E>
Basic tests on
Object.equals(Object), Object.hashCode() and Object.toString(), which must probably be valid for any override of those.- Since:
- 0.10
- Author:
- Michiel Meeuwissen
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionnet.jqwik.api.Arbitrary<@NonNull E>Provide non-nulldatapointsdefault net.jqwik.api.Arbitrary<@Nullable E>default net.jqwik.api.Arbitrary<@NonNull ? extends net.jqwik.api.Tuple.Tuple2<@NonNull E,@NonNull E>> default booleanThe implementation for equals datapoints (seeequalDatapoints().default voidequalsIsConsistent(E x, E y) For any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.default voidFor any non-null reference value x, x.equals(x) should return truedefault voidequalsIsSymmetric(E x, E y) For any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.default voidequalsIsTransitive(net.jqwik.api.Tuple.Tuple2<E, E> p1, net.jqwik.api.Tuple.Tuple2<E, E> p2) For any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.default voidFor any non-null reference value x, x.equals(null); should return false.default voidFor any non-null reference value x, x.equals(new Object); should return false.default voidhashCodeIsConsistentWithEquals(net.jqwik.api.Tuple.Tuple2<E, E> pair) If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.default voidWhenever it is invoked on the same object more than once the hashCode() method must consistently return the same integer.default Loggerlog()default net.jqwik.api.Arbitrary<Random>randoms()default voidtoString of an object may be anything, but it may not throw exceptions.
-
Field Details
-
DATAPOINTS
- See Also:
-
DATAPOINTS_OR_NULL
- See Also:
-
EQUAL_DATAPOINTS
- See Also:
-
RANDOMS
- See Also:
-
-
Method Details
-
equalsIsReflexive
For any non-null reference value x, x.equals(x) should return true -
equalsIsSymmetric
For any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true. -
equalsIsTransitive
@Property default void equalsIsTransitive(@ForAll("equalDatapoints") net.jqwik.api.Tuple.Tuple2<E, E> p1, @ForAll("equalDatapoints") net.jqwik.api.Tuple.Tuple2<E, E> p2) For any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true. -
equalsIsConsistent
@Property default void equalsIsConsistent(@ForAll("datapoints") E x, @ForAll("datapointsOrNull") E y) For any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified. -
equalsReturnFalseOnNull
For any non-null reference value x, x.equals(null); should return false. -
equalsReturnFalseOnOtherObject
For any non-null reference value x, x.equals(new Object); should return false. -
hashCodeIsSelfConsistent
Whenever it is invoked on the same object more than once the hashCode() method must consistently return the same integer. -
hashCodeIsConsistentWithEquals
@Property default void hashCodeIsConsistentWithEquals(@ForAll("equalDatapoints") net.jqwik.api.Tuple.Tuple2<E, E> pair) If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result. -
toString
toString of an object may be anything, but it may not throw exceptions. -
datapoints
Provide non-nulldatapoints -
equals
The implementation for equals datapoints (seeequalDatapoints(). Defaults toObjects.equals(Object, Object). -
equalDatapoints
-
datapointsOrNull
-
randoms
-
log
-