Java, junit and J#

I've been doing some work on an ongoing Java project recently.  Although JBuilder has some neat unit testing facilities built in, I was missing the ability to run a test without leaving the method.  Since the code I was working on was business logic rather than GUI code I was able to quickly port it to J#.  Luckily the Java collections classes are supported as well as the Java 1.1 API (this makes all the difference).  I'm now happily unit testing my Java project from inside VS.NET 2003.  Of cause it all still compiles with Java 1.3 as this is the target platform!  I have used the odd .jsl file to mirror or stub out Java code that doesn't work or won't compile.  The most annoying thing is that even though Java and .NET resources work in almost exactly the same way, Class.getResourceAsStream(...) isn't supported!  It takes only a few lines of code to find a .NET resource using a java.lang.Class object.  I'm baffled as to why this isn't supported.

All this means that the junit support in NUnitAddin has recieved a lot more dogfooding.  System.out and System.err will now be redirected to Console.Out and Console.Error when runnting tests with the junit test runner.  I'm now more productive in VS.NET than JBuilder (I can compile and test quicker).  If you're using NUnitAddin for Java development I'd be interested to know how you get on.  You can get the latest build here.

No Comments