Hi there, I would like to hear about what you're doing to test your Hibernate/EJB3 POJOs (if you're doing at all). I have a project with some of them, and I have the following concerns:
First of all, I may test them just ignoring persistence (already done). No problem here, just a bunch of TestNG tests running smoothly under Maven2. I think this is important, as I'm developing a library mainly intended to be used as annotated Hibernated POJOs, but maybe people using it prefer another persistence api. What do you think? Then I thought about testing the library including the persistence stuff, but this brings some problems: Problem 1: Whenver building the project, publishing the site, etc. you must have access to a runnning database in order to perform the tests. I'm currently running a postgresql database, but it may be cumbersome for users wanting to download and hack the sources. Maybe this could be solved using some kind of embeddable database? Or maybe I could create several profiles (never done this) and activate database tests only under demand? Problem 2: Having database tests involves having configuration data written down in some configuration file (the jdbc URL, user, password, etc. hibernate.cfg.xml) or even in the pom (jdbc driver dependency). It's kind of putting in the sources of the library some information that may be only of interest to me in my current environment. How to solve this? Again using some kind of embeddable datasource for tests? Using source filters? (again, I haven't done this before, so I don't know if it's suitable) Best regards Jose