As well as what others have said, consider not testing the class at
all but instead testing for a response to a particular message of
interest (so-called "duck typing" - see http://en.wikipedia.org/wiki/Duck_typing)
. That can be a lot more flexible. Another option is to declare a
formal protocol that is common to the possible classes of interest,
though in the example that wouldn't work because you can't force an
existing class to conform to a protocol without subclassing.