Skip to content

Commit

Permalink
Adds test case
Browse files Browse the repository at this point in the history
  • Loading branch information
jqno committed Nov 23, 2024
1 parent 67aaaec commit 0cb4a1c
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static nl.jqno.equalsverifier.internal.testhelpers.Util.defaultHashCode;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotSame;

import nl.jqno.equalsverifier.internal.exceptions.RecursionException;
import nl.jqno.equalsverifier.internal.reflection.Tuple;
Expand Down Expand Up @@ -78,6 +79,18 @@ public void giveClassWithFields() {
assertEquals(-10, IntContainer.STATIC_FINAL_I);
}

@Test
public void redCopyIsNotSameAsRed() {
Tuple<?> tuple = factory.createValues(
new TypeTag(IntContainer.class),
valueProvider,
attributes
);

assertEquals(tuple.getRed(), tuple.getRedCopy());
assertNotSame(tuple.getRed(), tuple.getRedCopy());
}

@Test
public void dontGiveRecursiveClass() {
ExpectedException
Expand Down Expand Up @@ -108,6 +121,7 @@ private <T> void assertCorrectTuple(Class<T> type, T expectedRed, T expectedBlue
Tuple<?> tuple = factory.createValues(new TypeTag(type), valueProvider, attributes);
assertEquals(expectedRed, tuple.getRed());
assertEquals(expectedBlue, tuple.getBlue());
assertEquals(expectedRed, tuple.getRedCopy());
}

private static final class IntContainer {
Expand Down

0 comments on commit 0cb4a1c

Please sign in to comment.