1717
1818import static org .assertj .core .api .Assertions .*;
1919
20+ import java .util .List ;
21+ import java .util .Map ;
22+
2023import org .junit .jupiter .api .Test ;
24+ import org .springframework .aop .SpringProxy ;
25+ import org .springframework .aop .framework .Advised ;
26+ import org .springframework .aot .hint .JdkProxyHint ;
2127import org .springframework .aot .hint .RuntimeHints ;
2228import org .springframework .aot .hint .TypeHint ;
2329import org .springframework .aot .hint .TypeReference ;
30+ import org .springframework .core .DecoratingProxy ;
2431import org .springframework .hateoas .Link ;
2532import org .springframework .hateoas .Links ;
33+ import org .springframework .hateoas .server .core .LastInvocationAware ;
2634
2735/**
28- * Unit tests for {@link RepresentationModelRuntimeHints }.
36+ * Unit tests for {@link HateoasTypesRuntimeHints }.
2937 *
3038 * @author Oliver Drotbohm
3139 */
@@ -34,16 +42,31 @@ class HateoasTypesRuntimeHintsUnitTests {
3442 @ Test // GH-1981
3543 void registersHintsForHateoasTypes () {
3644
37- var registrar = new HateoasTypesRuntimeHints ();
38- var hints = new RuntimeHints ();
39-
40- registrar .registerHints (hints , getClass ().getClassLoader ());
41-
42- assertThat (hints .reflection ().typeHints ())
45+ assertThat (createHints ().reflection ().typeHints ())
4346 .extracting (TypeHint ::getType )
4447 .extracting (TypeReference ::getSimpleName )
4548 .contains ("MapSuppressingUnwrappingSerializer" , //
4649 Link .class .getSimpleName (), //
4750 Links .class .getSimpleName ());
4851 }
52+
53+ @ Test // GH-2384
54+ void registersProxyHintsForLastInvocationAware () {
55+
56+ assertThat (createHints ().proxies ().jdkProxyHints ())
57+ .extracting (JdkProxyHint ::getProxiedInterfaces )
58+ .contains (List .of (TypeReference .of (LastInvocationAware .class ), TypeReference .of (Map .class ),
59+ TypeReference .of (SpringProxy .class ), TypeReference .of (Advised .class ),
60+ TypeReference .of (DecoratingProxy .class )));
61+ }
62+
63+ private static RuntimeHints createHints () {
64+
65+ var registrar = new HateoasTypesRuntimeHints ();
66+ var hints = new RuntimeHints ();
67+
68+ registrar .registerHints (hints , HateoasTypesRuntimeHintsUnitTests .class .getClassLoader ());
69+
70+ return hints ;
71+ }
4972}
0 commit comments