|
|
|
@ -47,6 +47,8 @@ import static org.mockito.Mockito.verify; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author Stephane Nicoll |
|
|
|
* @author Stephane Nicoll |
|
|
|
|
|
|
|
* @author Juergen Hoeller |
|
|
|
|
|
|
|
* @author Simon Baslé |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEventListenerTests { |
|
|
|
public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEventListenerTests { |
|
|
|
|
|
|
|
|
|
|
|
@ -81,6 +83,13 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv |
|
|
|
supportsEventType(false, method, ResolvableType.forClassWithGenerics(GenericTestEvent.class, Long.class)); |
|
|
|
supportsEventType(false, method, ResolvableType.forClassWithGenerics(GenericTestEvent.class, Long.class)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void genericListenerWithUnresolvedGenerics() { |
|
|
|
|
|
|
|
Method method = ReflectionUtils.findMethod( |
|
|
|
|
|
|
|
SampleEvents.class, "handleGenericString", GenericTestEvent.class); |
|
|
|
|
|
|
|
supportsEventType(true, method, ResolvableType.forClass(GenericTestEvent.class)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void listenerWithPayloadAndGenericInformation() { |
|
|
|
public void listenerWithPayloadAndGenericInformation() { |
|
|
|
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleString", String.class); |
|
|
|
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleString", String.class); |
|
|
|
@ -347,7 +356,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv |
|
|
|
var adapter = new ApplicationListenerMethodAdapter(null, ApplicationListenerMethodAdapterTests.class, method); |
|
|
|
var adapter = new ApplicationListenerMethodAdapter(null, ApplicationListenerMethodAdapterTests.class, method); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(adapter.supportsEventType(ResolvableType.forClass(EntityWrapper.class))) |
|
|
|
assertThat(adapter.supportsEventType(ResolvableType.forClass(EntityWrapper.class))) |
|
|
|
.as("handleGenericStringPayload(EntityWrapper<String>) with EntityWrapper<?>").isFalse(); |
|
|
|
.as("handleGenericStringPayload(EntityWrapper<String>) with EntityWrapper<?>").isTrue(); |
|
|
|
assertThat(adapter.supportsEventType(ResolvableType.forClassWithGenerics(EntityWrapper.class, Integer.class))) |
|
|
|
assertThat(adapter.supportsEventType(ResolvableType.forClassWithGenerics(EntityWrapper.class, Integer.class))) |
|
|
|
.as("handleGenericStringPayload(EntityWrapper<String>) with EntityWrapper<Integer>").isFalse(); |
|
|
|
.as("handleGenericStringPayload(EntityWrapper<String>) with EntityWrapper<Integer>").isFalse(); |
|
|
|
assertThat(adapter.supportsEventType(ResolvableType.forClassWithGenerics(EntityWrapper.class, String.class))) |
|
|
|
assertThat(adapter.supportsEventType(ResolvableType.forClassWithGenerics(EntityWrapper.class, String.class))) |
|
|
|
@ -378,7 +387,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv |
|
|
|
var adapter = new ApplicationListenerMethodAdapter(null, ApplicationListenerMethodAdapterTests.class, method); |
|
|
|
var adapter = new ApplicationListenerMethodAdapter(null, ApplicationListenerMethodAdapterTests.class, method); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(adapter.supportsEventType(ResolvableType.forClass(GenericTestEvent.class))) |
|
|
|
assertThat(adapter.supportsEventType(ResolvableType.forClass(GenericTestEvent.class))) |
|
|
|
.as("handleGenericString(GenericTestEvent<String>) with GenericTestEvent<?>").isFalse(); |
|
|
|
.as("handleGenericString(GenericTestEvent<String>) with GenericTestEvent<?>").isTrue(); |
|
|
|
assertThat(adapter.supportsEventType(ResolvableType.forClassWithGenerics(GenericTestEvent.class, Integer.class))) |
|
|
|
assertThat(adapter.supportsEventType(ResolvableType.forClassWithGenerics(GenericTestEvent.class, Integer.class))) |
|
|
|
.as("handleGenericString(GenericTestEvent<String>) with GenericTestEvent<Integer>").isFalse(); |
|
|
|
.as("handleGenericString(GenericTestEvent<String>) with GenericTestEvent<Integer>").isFalse(); |
|
|
|
assertThat(adapter.supportsEventType(ResolvableType.forClassWithGenerics(GenericTestEvent.class, String.class))) |
|
|
|
assertThat(adapter.supportsEventType(ResolvableType.forClassWithGenerics(GenericTestEvent.class, String.class))) |
|
|
|
|