You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/05/28 14:45:02 UTC

[isis] branch master updated: ISIS-2706: test fixes

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 49a9dc4  ISIS-2706: test fixes
49a9dc4 is described below

commit 49a9dc4f5a86e18bb8dba8d42aba52dabefe009a
Author: Andi Huber <ah...@apache.org>
AuthorDate: Fri May 28 16:44:52 2021 +0200

    ISIS-2706: test fixes
---
 .../JpaGeneratedLongIdEntityLifecycleTest.java           | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/regressiontests/stable-persistence-jpa/src/test/java/org/apache/isis/testdomain/persistence/jpa/entitylifecycle/JpaGeneratedLongIdEntityLifecycleTest.java b/regressiontests/stable-persistence-jpa/src/test/java/org/apache/isis/testdomain/persistence/jpa/entitylifecycle/JpaGeneratedLongIdEntityLifecycleTest.java
index 184bd39..c1a599c 100644
--- a/regressiontests/stable-persistence-jpa/src/test/java/org/apache/isis/testdomain/persistence/jpa/entitylifecycle/JpaGeneratedLongIdEntityLifecycleTest.java
+++ b/regressiontests/stable-persistence-jpa/src/test/java/org/apache/isis/testdomain/persistence/jpa/entitylifecycle/JpaGeneratedLongIdEntityLifecycleTest.java
@@ -133,9 +133,7 @@ class JpaGeneratedLongIdEntityLifecycleTest {
         repository.remove(entity.getPojo());
 
         // expected post-condition (after removal)
-        assertEquals(
-                EntityState.PERSISTABLE_DESTROYED,
-                ManagedObjects.EntityUtil.getEntityState(entity));
+        assertDetachedOrDeleted(entity);
 
         entityRef.set(entity);
     }
@@ -145,12 +143,18 @@ class JpaGeneratedLongIdEntityLifecycleTest {
 
         val entity = entityRef.get();
 
-        assertEquals(
-                EntityState.PERSISTABLE_DESTROYED,
-                ManagedObjects.EntityUtil.getEntityState(entity));
+        assertDetachedOrDeleted(entity);
         assertEquals(0, repository.allInstances(JpaEntityGeneratedLongId.class).size());
 
     }
 
+    // -- HELPER
+
+    public static void assertDetachedOrDeleted(final ManagedObject entity) {
+        assertEquals(
+                EntityState.PERSISTABLE_DETACHED, // if undecidable we currently return PERSISTABLE_DETACHED;
+                ManagedObjects.EntityUtil.getEntityState(entity));
+    }
+
 
 }