Hi, I wanted just to share my issues with unit testing a component collaborating with a Hits object.
The scenario is: I have a web page pagination component (say, it shows N results per page) over the Hits results found in the Lucene index. I want to test the pagination itselft, so I would like to provide it with a stub or mock Hits implementation. The problem is that Hits does not implement and interface, is final and has no public constructor (I am using Lucene 1.4.3, but the latest 2.x seems to be the same, which prevents me from subclassing it or mocking it (with EasyMock2 for example). So my solution would be to change my component collaborator type from Hits to a MyHits interface, which has a MyHitsImpl that works by delegation on a concrete Hits object.. Any thoughts about it? Best regards, -- Alessio Pace. http://www.jroller.com/page/alessiopace