|
16 | 16 |
|
17 | 17 | package org.springframework.aot.agent;
|
18 | 18 |
|
19 |
| -import java.lang.reflect.Method; |
20 | 19 | import java.lang.reflect.Proxy;
|
21 | 20 | import java.util.Collections;
|
22 | 21 | import java.util.Comparator;
|
@@ -193,9 +192,9 @@ void classGetConstructorsShouldNotMatchTypeReflectionHint() {
|
193 | 192 | }
|
194 | 193 |
|
195 | 194 | @Test
|
196 |
| - void classGetConstructorsShouldMatchConstructorReflectionHint() throws Exception { |
| 195 | + void classGetConstructorsShouldNotMatchConstructorReflectionHint() throws Exception { |
197 | 196 | hints.reflection().registerConstructor(String.class.getConstructor(), ExecutableMode.INVOKE);
|
198 |
| - assertThatInvocationMatches(InstrumentedMethod.CLASS_GETCONSTRUCTORS, this.stringGetConstructors); |
| 197 | + assertThatInvocationDoesNotMatch(InstrumentedMethod.CLASS_GETCONSTRUCTORS, this.stringGetConstructors); |
199 | 198 | }
|
200 | 199 |
|
201 | 200 | @Test
|
@@ -249,9 +248,9 @@ void classGetDeclaredConstructorsShouldNotMatchTypeReflectionHint() {
|
249 | 248 | }
|
250 | 249 |
|
251 | 250 | @Test
|
252 |
| - void classGetDeclaredConstructorsShouldMatchConstructorReflectionHint() throws Exception { |
| 251 | + void classGetDeclaredConstructorsShouldNotMatchConstructorReflectionHint() throws Exception { |
253 | 252 | hints.reflection().registerConstructor(String.class.getConstructor(), ExecutableMode.INVOKE);
|
254 |
| - assertThatInvocationMatches(InstrumentedMethod.CLASS_GETDECLAREDCONSTRUCTORS, this.stringGetDeclaredConstructors); |
| 253 | + assertThatInvocationDoesNotMatch(InstrumentedMethod.CLASS_GETDECLAREDCONSTRUCTORS, this.stringGetDeclaredConstructors); |
255 | 254 | }
|
256 | 255 |
|
257 | 256 | @Test
|
@@ -349,9 +348,9 @@ void classGetDeclaredMethodsShouldNotMatchTypeReflectionHint() {
|
349 | 348 | }
|
350 | 349 |
|
351 | 350 | @Test
|
352 |
| - void classGetDeclaredMethodsShouldMatchMethodReflectionHint() throws Exception { |
| 351 | + void classGetDeclaredMethodsShouldNotMatchMethodReflectionHint() throws Exception { |
353 | 352 | hints.reflection().registerMethod(String.class.getMethod("toString"), ExecutableMode.INVOKE);
|
354 |
| - assertThatInvocationMatches(InstrumentedMethod.CLASS_GETDECLAREDMETHODS, this.stringGetScaleMethod); |
| 353 | + assertThatInvocationDoesNotMatch(InstrumentedMethod.CLASS_GETDECLAREDMETHODS, this.stringGetScaleMethod); |
355 | 354 | }
|
356 | 355 |
|
357 | 356 | @Test
|
@@ -391,9 +390,9 @@ void classGetMethodsShouldNotMatchTypeReflectionHint() {
|
391 | 390 | }
|
392 | 391 |
|
393 | 392 | @Test
|
394 |
| - void classGetMethodsShouldMatchMethodReflectionHint() throws Exception { |
| 393 | + void classGetMethodsShouldNotMatchMethodReflectionHint() throws Exception { |
395 | 394 | hints.reflection().registerMethod(String.class.getMethod("toString"), ExecutableMode.INVOKE);
|
396 |
| - assertThatInvocationMatches(InstrumentedMethod.CLASS_GETMETHODS, this.stringGetMethods); |
| 395 | + assertThatInvocationDoesNotMatch(InstrumentedMethod.CLASS_GETMETHODS, this.stringGetMethods); |
397 | 396 | }
|
398 | 397 |
|
399 | 398 | @Test
|
@@ -452,28 +451,6 @@ void classGetMethodShouldNotMatchForWrongType() {
|
452 | 451 | assertThatInvocationDoesNotMatch(InstrumentedMethod.CLASS_GETMETHOD, this.stringGetToStringMethod);
|
453 | 452 | }
|
454 | 453 |
|
455 |
| - @Test |
456 |
| - void methodGetAnnotationsShouldMatchIntrospectHintOnMethod() throws NoSuchMethodException { |
457 |
| - Method toString = String.class.getMethod("toString"); |
458 |
| - RecordedInvocation invocation = RecordedInvocation.of(InstrumentedMethod.METHOD_GETANNOTATIONS) |
459 |
| - .onInstance(toString).withArguments("testString") |
460 |
| - .returnValue(toString.getAnnotations()).build(); |
461 |
| - hints.reflection().registerType(String.class, typeHint -> typeHint.withMethod("toString", |
462 |
| - Collections.emptyList(), ExecutableMode.INTROSPECT)); |
463 |
| - assertThatInvocationMatches(InstrumentedMethod.METHOD_GETANNOTATIONS, invocation); |
464 |
| - } |
465 |
| - |
466 |
| - @Test |
467 |
| - void methodGetParameterTypesShouldMatchIntrospectHintOnMethod() throws NoSuchMethodException { |
468 |
| - Method toString = String.class.getMethod("toString"); |
469 |
| - RecordedInvocation invocation = RecordedInvocation.of(InstrumentedMethod.METHOD_GETPARAMETERTYPES) |
470 |
| - .onInstance(toString).withArguments("testString") |
471 |
| - .returnValue(toString.getParameterTypes()).build(); |
472 |
| - hints.reflection().registerType(String.class, typeHint -> typeHint.withMethod("toString", |
473 |
| - Collections.emptyList(), ExecutableMode.INTROSPECT)); |
474 |
| - assertThatInvocationMatches(InstrumentedMethod.METHOD_GETPARAMETERTYPES, invocation); |
475 |
| - } |
476 |
| - |
477 | 454 | @Test
|
478 | 455 | void methodInvokeShouldMatchInvokeHintOnMethod() throws NoSuchMethodException {
|
479 | 456 | RecordedInvocation invocation = RecordedInvocation.of(InstrumentedMethod.METHOD_INVOKE)
|
@@ -555,9 +532,9 @@ void classGetDeclaredFieldsShouldNotMatchTypeHint() {
|
555 | 532 | }
|
556 | 533 |
|
557 | 534 | @Test
|
558 |
| - void classGetDeclaredFieldsShouldMatchFieldHint() throws Exception { |
| 535 | + void classGetDeclaredFieldsShouldNotMatchFieldHint() throws Exception { |
559 | 536 | hints.reflection().registerField(String.class.getDeclaredField("value"));
|
560 |
| - assertThatInvocationMatches(InstrumentedMethod.CLASS_GETDECLAREDFIELDS, this.stringGetDeclaredFields); |
| 537 | + assertThatInvocationDoesNotMatch(InstrumentedMethod.CLASS_GETDECLAREDFIELDS, this.stringGetDeclaredFields); |
561 | 538 | }
|
562 | 539 |
|
563 | 540 | @Test
|
@@ -626,9 +603,9 @@ void classGetFieldsShouldNotMatchTypeHint() {
|
626 | 603 | }
|
627 | 604 |
|
628 | 605 | @Test
|
629 |
| - void classGetFieldsShouldMatchFieldHint() throws Exception { |
| 606 | + void classGetFieldsShouldNotMatchFieldHint() throws Exception { |
630 | 607 | hints.reflection().registerField(String.class.getDeclaredField("value"));
|
631 |
| - assertThatInvocationMatches(InstrumentedMethod.CLASS_GETFIELDS, this.stringGetFields); |
| 608 | + assertThatInvocationDoesNotMatch(InstrumentedMethod.CLASS_GETFIELDS, this.stringGetFields); |
632 | 609 | }
|
633 | 610 |
|
634 | 611 | }
|
|
0 commit comments