Event Dispatcher  v0.1.6-beta.1
Project that offers a small library that allows to subscribe and fire events.
EqualsContract< T >

Detailed Description

This interface defines tests to verify that the objects implements correctly the.

equals

method, which implements an equivalence relation on non-null object references.

Note that it is generally necessary to override the

hashCode

method whenever the

equals

method is overridden, so as to maintain the general contract for the

hashCode

method, which states that equal objects must have equal hash codes.

Parameters
<T>the type of objects that this object may be compared to
See also
Object::equals(Object)
Object::hashCode()

Definition at line 28 of file EqualsContract.java.

+ Inheritance diagram for EqualsContract< T >:

Public Member Functions

createNotEqualValue ()
 
default void equalValueItself ()
 
default void notEqualNullValue ()
 
default void notEqualDifferentValue ()
 
- Public Member Functions inherited from Testable< T >
createValue ()
 

Member Function Documentation

◆ createNotEqualValue()

T createNotEqualValue ( )

Creates and returns a non equal value to use in the equality tests.


This method should return a value not equal to the returned by Testable#createValue for its correct execution.

Returns
the created value

Implemented in EqualsTest.PersonObjectEqualsTest, and EqualsTest.ObservedValueEqualsTest.

◆ equalValueItself()

default void equalValueItself ( )

Compares the created value to itself to test that the equality holds.

Definition at line 44 of file EqualsContract.java.

◆ notEqualNullValue()

default void notEqualNullValue ( )

Compares the created value to a.

null

to test that the equality does not hold.

Definition at line 55 of file EqualsContract.java.

◆ notEqualDifferentValue()

default void notEqualDifferentValue ( )

Compares the created value to a different value to test that the equality does not hold.

Definition at line 66 of file EqualsContract.java.