I believe there are some problems with the index manager and it's ability
to handle namespaces so I thought I'd write some unit tests as none exist
in this area.


Well it turns out to be very problematic for two main reasons. The
internal classes are all concrete and most of the methods are final.

Looking at IndexManager it's initialised with a collection. The collection
is used in 5 places and only a few methods are called (getSymbols,
getFiler, flushSymbolTable, and as an argument to a couple of constructors).

My first idea was to create a reflection proxy that responded in known
ways for these methods and spat the dummy for anything I didn't know was
needed. This is something I do all the time for tests. Opps, can't do
that, Collection isn't an interface :(.

Okay then I'll create a cheesy subclass and override the methods to
respond as I need. Nope, most of the methods are final.

I don't want to create an entire database for testing and I want to be
able to control the responses from methods like getSymbols but it looks as
though I'm going to have to make alot of infrastructure to run some simple
tests.

I'd like to create interfaces for the significant core components,
database, collection, whatever else people think is appropriate. This will
make creating unit tests alot easier. Thoughts?

-k.

Reply via email to