public SingularServerSpringMockitoTestConfig(Object myTestClass) { if (myTestClass.getClass().isAnnotationPresent(RunWith.class)) { Class<? extends Runner> runnerClass = myTestClass.getClass().getDeclaredAnnotation(RunWith.class).value(); if (runnerClass.isAssignableFrom(MockitoJUnitRunner.class)) { this.myTestClass = myTestClass; return; } } throw new IllegalArgumentException(this.getClass().getName() + " somente funciona com classes de teste cujo runner seja do tipo: " + MockitoJUnitRunner.class.getName()); }