Hello, My project is appFuse backend only (not modular). I am trying to add the following method to BaseObject so that "Date createdTimestamp" field (also defined in BaseObject) would automatically get populated.
@PrePersist private void fillCreatedTimestamp(){ this.createdTimestamp = Calendar.getInstance().getTime(); } When I run the test cases via running "mvn", this method gets called but I have faced some confusion: 1. In "UserManagerImplTest".testSaveUser(), right after saving user when I test the user.getCreatedTimestamp() it reads null 2. If I create another POJO say Address and corresponding DAO, Service and test cases and run "mvn" the test shows that the field gets populated. [I'm not quite sure if this difference is because UserSecurityAdvice or not] 3. No matter what, I don't see the saved object in database. I have a feeling that test cases is not touching the actual database where the tables are created and all the initial data in sample-data.xml is loaded, am I right? We grab an entity from the populated database and manipulate a field and the test cases prove that the field has changed but does it actually affect the database. If not, how can I actually change the data through test cases ( I know this is not desired but for my sanity) In the process of debugging this issue I have another confusion: I put a simple log statement in "GenericManagerImpl": save() public T save(T object) { System.out.println("Something") return dao.save(object); } and ran "mvn". There is no sign of "save" actually getting called although all managers supposedly extend this class and hence should be calling this method in order to save. Of course it would really help if I could run the test cases individually through Eclipse "Debug as test" but the only topic in forum I found was related to Ant not Maven or Eclipse setUp Any help would be greatly appreciated Thank, Arash Here is my sample AddressDaoTest class public class AddressDaoTest extends BaseDaoTestCase { @Autowired private IAddressDao addressDao; @Test public void testSaveAddress(){ Address address = new Address(); address.setStreet("5104 Old Street"); address.setCity("Santa Clara"); address.setState("CA"); address.setZip("94040"); Address savedAddress; savedAddress = addressDao.save(address); assertNotNull(savedAddress.getId()); assertNotNull(savedAddress.getCreatedTimestamp()); } @Test public void testExists() throws Exception { Long id = new Long(1); assertTrue(addressDao.exists(id)); } } -- View this message in context: http://n4.nabble.com/Understanding-Test-Cases-Tables-State-tp1311281p1311281.html Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net For additional commands, e-mail: users-h...@appfuse.dev.java.net