@Test public void testGetElementClass() { // the return type as defined in the base type MethodDescriptor methodDescriptor = getMethodDescriptor(CustomerRepository.class, "bar"); assertEquals(methodDescriptor.getElementClass(), Customer.class); // the return type is now the one as defined in the derived type (covariant return type) methodDescriptor = getMethodDescriptor(CustomerRepositoryExt.class, "bar"); assertEquals(methodDescriptor.getElementClass(), CustomerExtension.class); }