The whole generics thing is kinda throwing me for a loop, and more so the RTT.
Specificis? Ah well here\'s the gist:
enum QueryHelper {
query1,
Class.isInstance() doesn't work like your code expects. It tests whether the object you pass to it is an instance of the class. In you code:
expectedReturn.isInstance(SomeRelatedClass.class)
The object you're passing is a Class object. Try this instead, which returns true:
Class.class.isInstance(SomeRelatedClass.class);
What you're probably looking for is Class.isAssignableFrom(), e.g.:
Object.class.isAssignableFrom(Class.class);
Means you can do this:
Class klass = ...;
Object o = klass;