I have created my own annotation and this annotation receives class.class
. The class itself is extending another class.
I am trying to achieve almost the same as using @RunWith()
, but instead of running the class I would like to use it to get the class.class
in my parent class, so I will not need to send it in a @Before
annotation.
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Inherited
public @interface RunWithClass {
/** @return the classes to be run */
Class<?>[] value();
}
@RunWithClass(UnitTests.class)
public class UnitTests extends TestProxy {
and the method within TestProxy
private void updateClassReference() {
/**
here I would like to get the class in the above case will be UnitTests
(so I will be able to create an instance of the class for reflection
**/
}