アノテーションインターフェース EnabledIfRuntimeHintsAgent
@TargetSE({TYPESE,METHODSE})
@RetentionSE(RUNTIMESE)
@DocumentedSE
@EnabledIf(value="org.springframework.aot.agent.RuntimeHintsAgent#isLoaded",
disabledReason="RuntimeHintsAgent is not loaded on the current JVM")
@Tag("RuntimeHintsTests")
public @interface EnabledIfRuntimeHintsAgent
@EnabledIfRuntimeHintsAgent は、現在の JVM に RuntimeHintsAgent がロードされている場合にのみ、アノテーション付きのテストクラスまたはテストメソッドが有効になることを通知します。 これは @Tag("RuntimeHintsTests") でメタアノテーションが付けられているため、テストスイートはこれらのテストを対象にするか無視するかを選択できます。
@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);
}
}
- 導入:
- 6.0
- 作成者:
- Brian Clozel, Sam Brannen