One of the projects I’m working on at the moment has a *lot* of code written in a J2EE application which talks to Oracle using JDBC and Domino over CORBA. It actually all works really well but the approach of one of our non-Domino developers was really interesting to me, so I asked if I could write about it up here.
So the approach that Greg takes is test driven development, that is he writes his tests before writing the code. For his testing he would rather not connect to the Domino server all the time, but instead mock up objects to make sure that his other code works correctly. Enter EasyMock, which is a JAR file which you can include in any project that basically pretends to be whatever object you want it to be.
|
Java2html |
What this code shows is the use of EasyMock to be a Notes Document and a DateTime Object. You tell it what the methods that you want to call should return, and then, for all intents and purposes, the object is a Domino object but without having to go through the hassle of deploying your code to a server which has the rights to connect to a proper Domino server. Now of course this should only be used early on in the development lifecycle, but for environments where connecting to Domino can be difficult this is a real time saver.
Just to add: While searching material for a Java course I give to some developers internally I’ve found this excelent tutorial movie.
{ http://eclipsetutorial.sourceforge.net/totalbeginner.html“ rel=”nofollow” target =”blank”>Link }
Its for beginners in Java. It uses Eclipse and TDD methodology. I consider unit testing an absolute MUST these days.