views:

265

answers:

3

I am working on a project that is using JDK 1.4 and I am planning to write JUnit test cases in JDK 1.5 for several reasons like:

  1. I wanna explore JDK 1.5
  2. to use Mocking frameworks more efficiently.

Is it a good idea to do so?? (I've created two projects in Eclipse and am trying this)

+2  A: 

Yes go ahead. But you might not able to use few things for example generics. I mean if the original method is returing say, Map, you can't say in your test something like,

Map<String, Integer> map = someOriginalMehtod();

I suppose.

Adeel Ansari
you can do that, will just get a some unchecked warnings
Peter Kofler
A: 

Yeah is perfect. As long as you run it in Java 5 of course ;)

Java 1.4 is a subset of Java 1.5

OscarRyz
+1  A: 

No need for Java 5, as it seems James Carr backported Mockito to Java 4, see http://blog.james-carr.org/2009/10/01/using-mockito-with-junit3. I never used that backport personally though.

Adrian