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:
- I wanna explore JDK 1.5
- to use Moc开发者_高级运维king frameworks more efficiently.
Is it a good idea to do so?? (I've created two projects in Eclipse and am trying this)
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.
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.
Yeah is perfect. As long as you run it in Java 5 of course ;)
Java 1.4 is a subset of Java 1.5
精彩评论