Eclipse “Favorites” and JUnit 4 Static Imports Revised
After some time of using static imports workaround for JUnit 4 and EasyMock described earlier I came to the conclusion, that editing import "favorites" is not a good idea.
The problem is that when you include a class with static methods in Eclipse "favorites", then in Content Assistant you see hundred of those static methods. This maybe somewhat inconvenient. Moreover, Content Assistant hangs a bit longer before appearing.
From now on I am directly using class name like Assert.assert.. or EasyMock.expect.. instead of using static imports.
Hard-To-Mock Objects
What to do with objects, which are hard to mock?
For instance, you are working with org.w3c.dom. Suddenly you need a feature of extracting elements by tagname only from the first level. Since by default method getElementsByTagName returns all the elements from all levels, you decide to write your own method: