I was again away from the HQ for most of the week and today when I came back from the Merito Forum seminar, Pekka proudly showed what they had figured out with Joni while I was gone. In short, my first impressions are that this seems like a reasonably clean way of sharing fixtures between JUnit tests.
Ruby on Rails has a similar capability built right into the framework itself. Ok, ok, the Rails stuff is much more powerful than the above static import trick but obviously it would be possible to implement some sort of a YAML-fixtures-in-classpath utility on top of JUnit and Hibernate, for example.
TrackBacks[0]
Comments[2]
Posted by lasse on October 13, 2005 8:59:20 PM EEST
Reply |
Permalink
Re: Shared fixtures with Java 5 static imports
It's a very silly example.
Why not provide a static getter for semesters and use that in the two tests instead of static importing the (public) static field?!?
Comment from Anonymous on October 13, 2005 10:27:54 PM EEST
I disagree on the silliness part. While you can certainly use a static factory method, it is not as convinient for me because doing a method rename refactoring in Eclipse does not rename the fields. (Yes, I know IDEA does it but I am not using IDEA.)
Comment from Pekka Enberg on October 14, 2005 10:06:15 AM EEST
TrackBack to http://radio.javaranch.com/lasse/addTrackBack.action?entry=1129226360777







