|
31 | 31 | import org.junit.jupiter.api.BeforeEach;
|
32 | 32 | import org.junit.jupiter.api.Nested;
|
33 | 33 | import org.junit.jupiter.api.Test;
|
| 34 | +import org.reactivestreams.Publisher; |
34 | 35 |
|
35 | 36 | import org.springframework.aot.generate.GeneratedClass;
|
36 | 37 | import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
|
@@ -413,27 +414,35 @@ void multipleInitMethods() {
|
413 | 414 | @Test
|
414 | 415 | void noDestroyMethod() {
|
415 | 416 | compile((beanDef, compiled) -> assertThat(beanDef.getDestroyMethodNames()).isNull());
|
| 417 | + assertReflectionOnPublisher(); |
416 | 418 | }
|
417 | 419 |
|
418 | 420 | @Test
|
419 | 421 | void singleDestroyMethod() {
|
420 | 422 | beanDefinition.setDestroyMethodName("destroy");
|
421 | 423 | compile((beanDef, compiled) -> assertThat(beanDef.getDestroyMethodNames()).containsExactly("destroy"));
|
422 | 424 | assertHasMethodInvokeHints(InitDestroyBean.class, "destroy");
|
| 425 | + assertReflectionOnPublisher(); |
423 | 426 | }
|
424 | 427 |
|
425 | 428 | @Test
|
426 | 429 | void privateDestroyMethod() {
|
427 | 430 | beanDefinition.setDestroyMethodName(privateDestroyMethod);
|
428 | 431 | compile((beanDef, compiled) -> assertThat(beanDef.getDestroyMethodNames()).containsExactly(privateDestroyMethod));
|
429 | 432 | assertHasMethodInvokeHints(InitDestroyBean.class, "privateDestroy");
|
| 433 | + assertReflectionOnPublisher(); |
430 | 434 | }
|
431 | 435 |
|
432 | 436 | @Test
|
433 | 437 | void multipleDestroyMethods() {
|
434 | 438 | beanDefinition.setDestroyMethodNames("destroy", privateDestroyMethod);
|
435 | 439 | compile((beanDef, compiled) -> assertThat(beanDef.getDestroyMethodNames()).containsExactly("destroy", privateDestroyMethod));
|
436 | 440 | assertHasMethodInvokeHints(InitDestroyBean.class, "destroy", "privateDestroy");
|
| 441 | + assertReflectionOnPublisher(); |
| 442 | + } |
| 443 | + |
| 444 | + private void assertReflectionOnPublisher() { |
| 445 | + assertThat(RuntimeHintsPredicates.reflection().onType(Publisher.class)).accepts(generationContext.getRuntimeHints()); |
437 | 446 | }
|
438 | 447 |
|
439 | 448 | }
|
|
0 commit comments