GH-100 - Introduce AssertablePublishedEvents.
In case AssertJ is on the classpath, test cases using the PublishedEventsExtension (for example, implicitly activated via @ApplicationModuleTest) can get an AssertablePublishedEvents injected into the method. In contrast to the original PublishedEvents, that one acts as AssertProvider so that it can be used in assertThat(…).… expressions to verify application events published. Polished API in PublishedEvents for a more consistent experience.
This commit is contained in:
@@ -36,7 +36,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
public class PublishedEventsParameterResolverUnitTests {
|
||||
class PublishedEventsParameterResolverUnitTests {
|
||||
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
|
||||
|
||||
@@ -46,6 +46,7 @@ public class PublishedEventsParameterResolverUnitTests {
|
||||
PublishedEventsParameterResolver resolver = new PublishedEventsParameterResolver(__ -> context);
|
||||
|
||||
assertThat(resolver.supportsParameter(getParameterContext(PublishedEvents.class), null)).isTrue();
|
||||
assertThat(resolver.supportsParameter(getParameterContext(AssertablePublishedEvents.class), null)).isTrue();
|
||||
assertThat(resolver.supportsParameter(getParameterContext(Object.class), null)).isFalse();
|
||||
}
|
||||
|
||||
@@ -99,5 +100,7 @@ public class PublishedEventsParameterResolverUnitTests {
|
||||
void with(PublishedEvents events);
|
||||
|
||||
void with(Object object);
|
||||
|
||||
void with(AssertablePublishedEvents events);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user