Annotation Interface EnabledIfRuntimeHintsAgent


@Target({TYPE,METHOD}) @Retention(RUNTIME) @Documented @EnabledIf(value="org.springframework.aot.agent.RuntimeHintsAgent#isLoaded", disabledReason="RuntimeHintsAgent is not loaded on the current JVM") @Tag("RuntimeHintsTests") public @interface EnabledIfRuntimeHintsAgent
@EnabledIfRuntimeHintsAgent signals that the annotated test class or test method is only enabled if the RuntimeHintsAgent is loaded on the current JVM.

This is meta-annotated with @Tag("RuntimeHintsTests") so that test suites can choose to target or ignore those tests.

 @EnabledIfRuntimeHintsAgent
 class MyTestCases {

     @Test
     void hintsForMethodsReflectionShouldMatch() {
         RuntimeHints hints = new RuntimeHints();
         hints.reflection().registerType(String.class,
             hint -> hint.withMembers(MemberCategory.INTROSPECT_PUBLIC_METHODS));

         RuntimeHintsInvocations invocations = RuntimeHintsRecorder.record(() -> {
             Method[] methods = String.class.getMethods();
         });
         assertThat(invocations).match(hints);
     }

 }
 
Since:
6.0
Author:
Brian Clozel, Sam Brannen