Prior JPA 2.1, most JPA providers (Hibernate, EclipseLink, OpenJPA) would have a proprietary way to generate the database schema (Data Definition Language scripts) from Entities. In the JPA 2.1 specification (JSR 338) there is a new section called 9.4 Schema Generation introducing an API and some properties to generate a database schema in a standard and portable way. Properties in persistence.xml In the […]
After the announcement of the NoMock Movement I had to write another post about integration testing. Here it goes : how to test your nice RESTful URIs ? Use Case Often you hear that URIs have to be expressive… and you want to test that your URIs are nicely written. How do you do that ? Unit testing with mock […]
I would like to thank Arnaud Heritier who gave me plenty of tips and advices to write this blog. In fact if you want to endorse someone on Maven in LinkedIn, he is the man, not me ;o) If you use Maven in your projects you might wonder what “Let’s Turn Integration Tests with Maven into a First-Class Citizen” means. A […]
Everything started when Eve said ‘No‘ when God told her not to eat the fruit. Then my daughter said ‘No‘ when I told her to clean her room. Then we had a bunch of guys saying ‘No‘ to SQL. Then I read Is there such a thing as the NoMock movement?… And today I’m saying let’s launch the NoMock Movement […]
A short blog about a topic I was discussing last week with a customer: testing SOAP Web Services. If you follow my blog you would know by now that I’m not a fan of unit testing in MOCK environments. Not because I don’t like it or I have religious believes that don’t allow me to use JUnit and Mockito. It’s just because with […]
It's 2012 and my first resolution of the year is to finally tell the truth about testing : unit testing is pretty much useless when your code runs inside a container. How do you unit test an EJB which relies on the container services (i.e transaction, injection, security...) ? Well, you mock the database access, you mock your security layer, you mock your dependencies, you mock your validation layer... to test what ? A bit of business logic. Yes. Unit test is interesting when you have complex business logic to test so you can have quick feedback. Otherwise, it's a waste of time which doesn't test your container services. So I'm not saying unit testing is completely useless, I'm saying that integration testing is also to be considered when you run your code inside a Java EE container.