diff --git a/equalsverifier-core/src/test/java/nl/jqno/equalsverifier/internal/reflection/vintage/prefabvalues/factories/FallbackFactoryTest.java b/equalsverifier-core/src/test/java/nl/jqno/equalsverifier/internal/reflection/vintage/prefabvalues/factories/FallbackFactoryTest.java index ff91709c4..af6902890 100644 --- a/equalsverifier-core/src/test/java/nl/jqno/equalsverifier/internal/reflection/vintage/prefabvalues/factories/FallbackFactoryTest.java +++ b/equalsverifier-core/src/test/java/nl/jqno/equalsverifier/internal/reflection/vintage/prefabvalues/factories/FallbackFactoryTest.java @@ -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 java.util.LinkedHashSet; import nl.jqno.equalsverifier.internal.exceptions.RecursionException; @@ -74,6 +75,18 @@ public void giveClassWithFields() { assertEquals(-10, IntContainer.STATIC_FINAL_I); } + @Test + public void redCopyIsNotSameAsRed() { + Tuple tuple = factory.createValues( + new TypeTag(IntContainer.class), + valueProvider, + typeStack + ); + + assertEquals(tuple.getRed(), tuple.getRedCopy()); + assertNotSame(tuple.getRed(), tuple.getRedCopy()); + } + @Test public void dontGiveRecursiveClass() { ExpectedException @@ -103,6 +116,7 @@ private void assertCorrectTuple(Class type, T expectedRed, T expectedBlue Tuple tuple = factory.createValues(new TypeTag(type), valueProvider, typeStack); assertEquals(expectedRed, tuple.getRed()); assertEquals(expectedBlue, tuple.getBlue()); + assertEquals(expectedRed, tuple.getRedCopy()); } private static final class IntContainer {