diff --git a/pom.xml b/pom.xml
index 5fb5fc3d9..17bb1353b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,6 +35,10 @@
${java.version}
+
+ maven-surefire-plugin
+ 2.22.2
+
org.apache.maven.plugins
maven-resources-plugin
@@ -162,6 +166,19 @@
+
+
+
+
+ org.junit
+ junit-bom
+ 5.8.2
+ pom
+ import
+
+
+
+
com.drewnoakes
@@ -220,6 +237,11 @@
4.13.2
test
+
+ org.junit.jupiter
+ junit-jupiter
+ test
+
com.h2database
h2
diff --git a/src/test/java/org/isf/OHApplicationContextAware.java b/src/test/java/org/isf/OHApplicationContextAware.java
new file mode 100644
index 000000000..de0784d39
--- /dev/null
+++ b/src/test/java/org/isf/OHApplicationContextAware.java
@@ -0,0 +1,43 @@
+/*
+ * Open Hospital (www.open-hospital.org)
+ * Copyright © 2006-2022 Informatici Senza Frontiere (info@informaticisenzafrontiere.org)
+ *
+ * Open Hospital is a free and open source software for healthcare data management.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * https://www.gnu.org/licenses/gpl-3.0-standalone.html
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.isf;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class OHApplicationContextAware implements ApplicationContextAware {
+
+ public static ApplicationContext applicationContext;
+
+ public OHApplicationContextAware() {
+ ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
+ setApplicationContext(context);
+ }
+
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+ this.applicationContext = applicationContext;
+ }
+
+}
diff --git a/src/test/java/org/isf/OHCoreTestCase5.java b/src/test/java/org/isf/OHCoreTestCase5.java
new file mode 100755
index 000000000..3226b34c5
--- /dev/null
+++ b/src/test/java/org/isf/OHCoreTestCase5.java
@@ -0,0 +1,59 @@
+/*
+ * Open Hospital (www.open-hospital.org)
+ * Copyright © 2006-2022 Informatici Senza Frontiere (info@informaticisenzafrontiere.org)
+ *
+ * Open Hospital is a free and open source software for healthcare data management.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * https://www.gnu.org/licenses/gpl-3.0-standalone.html
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.isf;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+@ExtendWith(SpringExtension.class)
+@ContextConfiguration(locations = { "classpath:applicationContext.xml" })
+public abstract class OHCoreTestCase5 {
+
+ @Autowired
+ private EntityManagerFactory entityManagerFactory;
+
+ public void cleanH2InMemoryDb() {
+ EntityManager entityManager = entityManagerFactory.createEntityManager();
+ entityManager.getTransaction().begin();
+ List