You probably want `expectedType.isAssignableFrom(Object.class)`.