}
private static String getGbeNameFromGbeAnnotation(TestDescription testDescription) {
Class<?> testCaseClass = testDescription.getTestCaseClass();
GuiceBerryEnv gbeAnnotation = getGbeAnnotation(testCaseClass);
AnnotatedGuiceBerryEnv annotatedGbeAnnotation = getAnnotatedGbeAnnotation(testCaseClass);
if ((gbeAnnotation != null) && (annotatedGbeAnnotation != null)) {
throw new IllegalArgumentException("It seems your test used both the "
+ "deprecated GuiceBerryEnv and AnnotatedGuiceBerryEnv annotations."
+ "Please remove the deprecated one.");
}
String declaredGbeName;
if (gbeAnnotation != null) {
declaredGbeName = gbeAnnotation.value();
} else if (annotatedGbeAnnotation != null) {
declaredGbeName = annotatedGbeAnnotation.value();
} else {
throw new IllegalArgumentException(String.format(
"In order to use the deprecated GuiceBerryJunit3, your test class "
+ "must have a @GuiceBerryEnv annotation. Either add one, or, better "
+ "yet, upgrade your code to make use of the GuiceBerry 3.0 adapters. "