Created
July 14, 2022 22:23
-
-
Save beyondxscratch/6c3a134c6f40a391819a13be11900252 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface EqualityTest<T> { | |
T createValue(); | |
T createOtherValue(); | |
@Test | |
default void should_be_equal() { | |
assertThat(createValue()).isEqualTo(createValue()); | |
assertThat(createValue().hashCode()).isEqualTo(createValue().hashCode()); | |
} | |
@Test | |
default void should_not_be_equal() { | |
assertThat(createValue()).isNotEqualTo(createOtherValue()); | |
assertThat(createValue().hashCode()).isNotEqualTo(createOtherValue().hashCode()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment