Let test helper collect all annotation to produce a full union
This commit is contained in:
parent
087b9d83ff
commit
d73a5cde38
|
@ -125,14 +125,27 @@ public final class Helper {
|
||||||
FrameworkMethod frameworkMethod,
|
FrameworkMethod frameworkMethod,
|
||||||
TestClass testClass) {
|
TestClass testClass) {
|
||||||
final List<S> collection = new LinkedList<S>();
|
final List<S> collection = new LinkedList<S>();
|
||||||
final S singularAnn = Helper.locateAnnotation( singularAnnotationClass, frameworkMethod, testClass );
|
final S methodSingularAnn = frameworkMethod.getAnnotation( singularAnnotationClass );
|
||||||
if ( singularAnn != null ) {
|
if ( methodSingularAnn != null ) {
|
||||||
collection.add( singularAnn );
|
collection.add( methodSingularAnn );
|
||||||
}
|
}
|
||||||
final P pluralAnn = Helper.locateAnnotation( pluralAnnotationClass, frameworkMethod, testClass );
|
final S classSingularAnn = testClass.getAnnotation( singularAnnotationClass );
|
||||||
if ( pluralAnn != null ) {
|
if ( classSingularAnn != null ) {
|
||||||
|
collection.add( classSingularAnn );
|
||||||
|
}
|
||||||
|
final P methodPluralAnn = frameworkMethod.getAnnotation( pluralAnnotationClass );
|
||||||
|
if ( methodPluralAnn != null ) {
|
||||||
try {
|
try {
|
||||||
collection.addAll( Arrays.asList( (S[]) pluralAnnotationClass.getDeclaredMethods()[0].invoke( pluralAnn ) ) );
|
collection.addAll( Arrays.asList( (S[]) pluralAnnotationClass.getDeclaredMethods()[0].invoke( methodPluralAnn ) ) );
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
throw new RuntimeException( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final P classPluralAnn = testClass.getAnnotation( pluralAnnotationClass );
|
||||||
|
if ( classPluralAnn != null ) {
|
||||||
|
try {
|
||||||
|
collection.addAll( Arrays.asList( (S[]) pluralAnnotationClass.getDeclaredMethods()[0].invoke( classPluralAnn ) ) );
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw new RuntimeException( e );
|
throw new RuntimeException( e );
|
||||||
|
|
Loading…
Reference in New Issue