Developers, Developers, Developers! Maksim Sorokin IT Blog

12Mar/103

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: