Event Dispatcher  v0.1.6-beta.1
Project that offers a small library that allows to subscribe and fire events.
EqualsContract.java
Go to the documentation of this file.
1 package com.fermod.contract;
2 
3 import static org.junit.jupiter.api.Assertions.assertEquals;
4 import static org.junit.jupiter.api.Assertions.assertFalse;
5 import static org.junit.jupiter.api.Assertions.assertNotEquals;
6 
7 import org.junit.jupiter.api.DisplayName;
8 import org.junit.jupiter.api.Tag;
9 import org.junit.jupiter.api.Test;
10 
26 @DisplayName("Equals Test")
27 @Tag("equals")
28 public interface EqualsContract<T> extends Testable<T> {
29 
37  T createNotEqualValue();
38 
42  @DisplayName("Equals Itself - True")
43  @Test
44  default void equalValueItself() {
45  T value = createValue();
46  assertEquals(value, value);
47  }
48 
53  @DisplayName("Equals Null - False")
54  @Test
55  default void notEqualNullValue() {
56  T value = createValue();
57  assertFalse(value.equals(null));
58  }
59 
64  @DisplayName("Equals Different - False")
65  @Test
66  default void notEqualDifferentValue() {
67  T value = createValue();
68  T differentValue = createNotEqualValue();
69  assertNotEquals(value, differentValue);
70  assertNotEquals(differentValue, value);
71  }
72 
73 }
default void notEqualNullValue()
Compares the created value to a.
default void equalValueItself()
Compares the created value to itself to test that the equality holds.
default void notEqualDifferentValue()
Compares the created value to a different value to test that the equality does not hold.
The Testable class represents a testable type used by other classes for the use of their own tests.
Definition: Testable.java:9
This interface defines tests to verify that the objects implements correctly the.