File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
approvaltests-tests/src/test/java/org/approvaltests/namer
approvaltests/src/main/java/org/approvaltests/namer Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ void testDetectionOfAnnotationsThatAreMarkedTestable()
1919 StackTraceElement element = ThreadUtils .getStackTrace ()[2 ];
2020 assertTrue (AttributeStackSelector .isTestableMethod (element ));
2121 }
22+ @ Example ()
23+ void testDetectionOfAnnotationsThatAreIndirectlyMarkedTestable ()
24+ {
25+ StackTraceElement element = ThreadUtils .getStackTrace ()[2 ];
26+ assertTrue (AttributeStackSelector .isTestableMethod (element ));
27+ }
2228 @ Test
2329 void unrollLambda ()
2430 {
Original file line number Diff line number Diff line change 55import com .spun .util .io .StackElementSelector ;
66import com .spun .util .tests .TestUtils ;
77import org .junit .platform .commons .annotation .Testable ;
8+ import org .junit .platform .commons .util .AnnotationUtils ;
89
910import java .lang .annotation .Annotation ;
1011import java .lang .reflect .Method ;
@@ -90,20 +91,11 @@ public static boolean isTestableMethod(StackTraceElement element)
9091 { return false ; }
9192 for (Method method : methods )
9293 {
93- Annotation [] annotations = method .getAnnotations ();
94- for (Annotation annotation : annotations )
95- {
96- if (isTestableAnnotation (annotation ))
97- { return true ; }
98- }
94+ if (AnnotationUtils .isAnnotated (method , Testable .class ))
95+ { return true ; }
9996 }
10097 return false ;
10198 }
102- public static boolean isTestableAnnotation (Annotation annotation )
103- {
104- Class <? extends Annotation > annotationType = annotation .annotationType ();
105- return annotationType .isAnnotationPresent (Testable .class );
106- }
10799 private boolean isJunit3Test (Class <?> clazz )
108100 {
109101 Class <?> testcase = loadClass ("junit.framework.TestCase" );
You can’t perform that action at this time.
0 commit comments