I am developing a Java Enterprise application and I would like to unit test it.
Does anyone know which tool I should use to do so, and does anyone know any examples or tutorials?
I am developing a Java Enterprise application and I would like to unit test it.
Does anyone know which tool I should use to do so, and does anyone know any examples or tutorials?
I will assume that by 'Enterprise Application' you mean mainly the EJB part of it.
So, if you want to test EJB 3.1 (as you're working on Java EE 6) you can use the environment of your choice - just like for any other non-Java EE development - i.e. JUnit - and use the EJB embedded container feature. It should do the work for unit testing.
For integration testing I hope you'll find this link to be of any help: In TDD, why OpenEJB and why Arquillian?
If you are looking for integration tests then have a look at Arquillian.
For ordinary unit tests, you should testing behaviour of isolated objects, Mockito, PowerMockito and JUnit are your friends
For an annotation-based EJB that uses dependency injection (which all newly-developed EJBs on Java EE 6 should be) you don't really need anything except a testing framework (usually JUnit, but TestNG is supposed to be better) and a mocking framework (Mockito and EasyMock are popular choices). The rest is pretty straightforward, as described in this article.
Of course, there's a lot more to Java EE than EJBs, and for other parts of the stack (most notably web UIs), unit testing may require more elaborate techniques.