I'm trying to implement different testing strategies using JUnit. So basically, I implemented my own Runner which collects custom annotations similar to the suite runner. Next I use this information to prioritize/group/etc tests in different ways. This allows me to still use the Eclipse plugin, while having my own JUnit extension.
However, the problem I'm running into at the moment is that whenever I have two descriptions with the same display name, then they have the same hashcode. If you take things like "groups", then these descriptions do differ in my case because they are in different groups. One solution would be to prefix the description with the group name, but i would rather like to extend the description class and use the parent/child relations to model groups.
So what's the problem? Well, if two descriptions have the same hashcode, then it becomes impossible for Eclipse to correctly show the running/finished/failed tests, because notification for description 1 and 2 are done on the same hashcode.
I hope that explains the problem. My question is rather simple. Is it an option for the JUnit development team to make the Description constructor protected in their next release (or even better: nightly build).
Thanks in advance,
> Date: Tue, 14 Oct 2008 09:00:57 -0400 > From: firstname.lastname@example.org > To: email@example.com > Subject: Re: [Junit-devel] Extending the Description class > CC: firstname.lastname@example.org > > Mark, > > I'd like to understand a little better what you're doing. Are you > fine-tuning the performance of a HashMap with Descriptions as keys? > > David Saff > > On Tue, Oct 14, 2008 at 3:02 AM, Mark Stobbe <email@example.com> wrote: > > Hello JUnit developer team, > > > > I have a question, or rather a request: could you make the constructor (and > > possibly the fields) of org.junit.runner.Description "protected" instead of > > "private". In this way it is impossible to normally subclass Description > > with a custom implementation. > > > > Why would you like to subclass Description? Well, the latest implementation > > of Description has a rather difficult hashCode implementation, namely: > > hashCode = getDisplayName().hashCode(). This poses a problem (or not, but in > > my case it does) when you create multiple instances of the Description class > > with the same name. > > > > Hopefully you are willing to incorporate this minor modification, it would > > surely make my life easier. > > > > Big thanks, > > Mark Stobbe > > ________________________________ > > Plan je evenement, nodig mensen uit en deel je foto's met Windows Live > > Events > > ------------------------------------------------------------------------- > > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > > Build the coolest Linux based applications with Moblin SDK & win great > > prizes > > Grand prize is a trip for two to an Open Source event anywhere in the world > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > _______________________________________________ > > Junit-devel mailing list > > Junitfirstname.lastname@example.org > > https://lists.sourceforge.net/lists/listinfo/junit-devel > > > >