@Override
protected String[] getClassesToModify(AnnotatedElement element) {
Set<String> all = new LinkedHashSet<String>();
addTestCase(all, element);
PrepareForTest prepareForTestAnnotation = element.getAnnotation(PrepareForTest.class);
PrepareOnlyThisForTest prepareOnlyThisForTestAnnotation = element.getAnnotation(PrepareOnlyThisForTest.class);
final boolean prepareForTestAnnotationPresent = prepareForTestAnnotation != null;
final boolean prepareOnlyThisForTestAnnotationPresent = prepareOnlyThisForTestAnnotation != null;
if (!prepareForTestAnnotationPresent && !prepareOnlyThisForTestAnnotationPresent) {
return null;
}
if (prepareForTestAnnotationPresent) {
final Class<?>[] classesToMock = prepareForTestAnnotation.value();
for (Class<?> classToMock : classesToMock) {
if (!classToMock.equals(IndicateReloadClass.class)) {
addClassHierarchy(all, classToMock);
}
}
addFullyQualifiedNames(all, prepareForTestAnnotation);
}
if (prepareOnlyThisForTestAnnotationPresent) {
final Class<?>[] classesToMock = prepareOnlyThisForTestAnnotation.value();
for (Class<?> classToMock : classesToMock) {
if (!classToMock.equals(IndicateReloadClass.class)) {
all.add(classToMock.getName());
}
}