3 Replies Latest reply on Apr 15, 2015 7:30 AM by Michael Awizen

    Persistence configuration for JUnit tests based on JbpmJUnitBaseTestCase

    Michael Awizen Novice

      Hi everybody,

       

      how to set-up the JUnit test environment to make persistent entities available for all test methods?

       

      Please take a look at this small test. The set-up method persists a new user using  the helper methods from JbpmJUnitBaseTestCase. Unfortunately the user can not be found in the test method.

       

      public class EntityManagerTest extends JbpmJUnitBaseTestCase {
      
          @Test
          public void testEvaluationProcess() {
      
              EntityManager entityManager = getEmf().createEntityManager();
              UserImpl user = entityManager.find(UserImpl.class, "newUserId");
      
              assertNotNull("User not found!", user);
          }
      
          public EntityManagerTest() {
              super(true, true);
          }
      
          @Override
          @Before
          public void setUp() throws Exception{
              super.setUp();
      
              EntityManager entityManager = getEmf().createEntityManager();
              entityManager.persist(new UserImpl("newUserId"));
          }
      }
      
      
      
      
      
      
      
      
      

       

      Any suggestions?