diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/collections/mappedsuperclasselement/CollectionOfMappedSuperclassComponentsTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/collections/mappedsuperclasselement/CollectionOfMappedSuperclassComponentsTest.java index c1df1f1a65..1300070ece 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/collections/mappedsuperclasselement/CollectionOfMappedSuperclassComponentsTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/collections/mappedsuperclasselement/CollectionOfMappedSuperclassComponentsTest.java @@ -31,15 +31,15 @@ import org.junit.Test; import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.Priority; +import org.hibernate.testing.FailureExpected; import org.hibernate.testing.TestForIssue; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; /** * @author Gail Badner */ -@TestForIssue( jiraKey = "HHH-8908" ) +@TestForIssue( jiraKey = "HHH-9193" ) public class CollectionOfMappedSuperclassComponentsTest extends BaseEnversJPAFunctionalTestCase { private Integer id1; @@ -84,6 +84,7 @@ public class CollectionOfMappedSuperclassComponentsTest extends BaseEnversJPAFun } @Test + @FailureExpected( jiraKey = "HHH-9193") public void testHistoryOfId1() { MappedSuperclassComponentSetTestEntity entity = getAuditReader().find( MappedSuperclassComponentSetTestEntity.class, @@ -94,9 +95,15 @@ public class CollectionOfMappedSuperclassComponentsTest extends BaseEnversJPAFun assertEquals( 0, entity.getCompsNotAudited().size() ); entity = getAuditReader().find( MappedSuperclassComponentSetTestEntity.class, id1, 2 ); + + // TODO: what is the expectation here? The collection is audited, but the embeddable class + // has no data and it extends a mapped-superclass that is not audited. + // currently the collection has 1 element that has value AbstractCode.UNDEFINED + // (which seems wrong). I changed the expected size to 0 which currently fails; is that what + // should be expected? Set comps1 = entity.getComps(); - assertEquals( 1, comps1.size() ); - assertTrue( comps1.contains( new Code( 1 ) ) ); + assertEquals( 0, comps1.size() ); + // The contents of entity.getCompsNotAudited() is unspecified, so no need to test. } } \ No newline at end of file diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/mappedsuperclass/EmbeddableWithDeclaredDataTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/mappedsuperclass/EmbeddableWithDeclaredDataTest.java index 4e30b3316b..1b77d24f50 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/mappedsuperclass/EmbeddableWithDeclaredDataTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/mappedsuperclass/EmbeddableWithDeclaredDataTest.java @@ -34,13 +34,14 @@ import org.hibernate.envers.AuditReader; import org.hibernate.envers.AuditReaderFactory; import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.Priority; +import org.hibernate.testing.FailureExpected; import org.hibernate.testing.TestForIssue; /** * @author Jakob Braeuchi. * @author Gail Badner */ -@TestForIssue(jiraKey = "HHH-8908") +@TestForIssue(jiraKey = "HHH-9193") public class EmbeddableWithDeclaredDataTest extends BaseEnversJPAFunctionalTestCase { private long id; @@ -68,6 +69,7 @@ public class EmbeddableWithDeclaredDataTest extends BaseEnversJPAFunctionalTestC } @Test + @FailureExpected( jiraKey = "HHH-9193" ) public void testEmbeddableThatExtendsMappedSuperclass() { // Reload and Compare Revision @@ -83,7 +85,9 @@ public class EmbeddableWithDeclaredDataTest extends BaseEnversJPAFunctionalTestC Assert.assertEquals( entityLoaded.getName(), entityRev1.getName() ); - // value is read from AUD Table - Assert.assertEquals( entityLoaded.getValue(), entityRev1.getValue() ); + // only value.codeArt should be audited because it is the only audited field in EmbeddableWithDeclaredData; + // fields in AbstractEmbeddable should not be audited. + Assert.assertEquals( entityLoaded.getValue().getCodeart(), entityRev1.getValue().getCodeart() ); + Assert.assertNull( entityRev1.getValue().getCode() ); } } diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/mappedsuperclass/EmbeddableWithNoDeclaredData.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/mappedsuperclass/EmbeddableWithNoDeclaredData.java index 4a38cbc72e..4d2bea6312 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/mappedsuperclass/EmbeddableWithNoDeclaredData.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/mappedsuperclass/EmbeddableWithNoDeclaredData.java @@ -24,7 +24,6 @@ package org.hibernate.envers.test.integration.components.mappedsuperclass; import javax.persistence.Embeddable; -import javax.persistence.Transient; /** * @author Jakob Braeuchi. diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/mappedsuperclass/EmbeddableWithNoDeclaredDataTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/mappedsuperclass/EmbeddableWithNoDeclaredDataTest.java index aa49597182..43832d287f 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/mappedsuperclass/EmbeddableWithNoDeclaredDataTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/components/mappedsuperclass/EmbeddableWithNoDeclaredDataTest.java @@ -40,7 +40,7 @@ import org.hibernate.testing.TestForIssue; * @author Jakob Braeuchi. * @author Gail Badner */ -@TestForIssue(jiraKey = "HHH-8908") +@TestForIssue(jiraKey = "HHH-9193") public class EmbeddableWithNoDeclaredDataTest extends BaseEnversJPAFunctionalTestCase { private long id; @@ -83,7 +83,8 @@ public class EmbeddableWithNoDeclaredDataTest extends BaseEnversJPAFunctionalTes Assert.assertEquals( entityLoaded.getName(), entityRev1.getName() ); - // value is read from AUD Table - Assert.assertEquals( entityLoaded.getValue(), entityRev1.getValue() ); + // value should be null because there is no data in EmbeddableWithNoDeclaredData + // and the fields in AbstractEmbeddable should not be audited. + Assert.assertNull( entityRev1.getValue() ); } }