private void process(RolPersistence service, RolEntityMock mock, Integer idRol) { System.out.println("----- "); System.out.println(" . load : "); RolEntity entity = service.load(idRol); if (entity != null) { // Found System.out.println(" FOUND : " + entity); // Save (update) with the same values to avoid database integrity errors System.out.println(" . save : " + entity); service.save(entity); System.out.println(" saved : " + entity); } else { // Not found System.out.println(" NOT FOUND"); // Create a new instance entity = mock.createInstance(idRol); Assert.assertNotNull(entity); // No reference : insert is possible // Try to insert the new instance System.out.println(" . insert : " + entity); service.insert(entity); System.out.println(" inserted : " + entity); System.out.println(" . delete : "); boolean deleted = service.delete(idRol); System.out.println(" deleted = " + deleted); Assert.assertTrue(deleted); } }
@Test public void test1() { System.out.println("Test count ..."); RolPersistence service = PersistenceServiceProvider.getService(RolPersistence.class); System.out.println("CountAll = " + service.countAll()); }