31
31
import org .awaitility .core .ConditionFactory ;
32
32
import org .springframework .context .ApplicationEventPublisher ;
33
33
import org .springframework .lang .Nullable ;
34
+ import org .springframework .modulith .core .util .CheckReturnValue ;
34
35
import org .springframework .modulith .test .PublishedEvents .TypedPublishedEvents ;
35
36
import org .springframework .modulith .test .PublishedEventsAssert .PublishedEventAssert ;
36
37
import org .springframework .modulith .test .Scenario .When .EventResult ;
53
54
* @author Oliver Drotbohm
54
55
* @see ApplicationModuleTest
55
56
*/
57
+ @ CheckReturnValue
56
58
public class Scenario {
57
59
58
60
private static final Predicate <Object > DEFAULT_ACCEPTANCE = it -> {
@@ -216,6 +218,7 @@ Scenario setDefaultCustomizer(Function<ConditionFactory, ConditionFactory> custo
216
218
return this ;
217
219
}
218
220
221
+ @ CheckReturnValue
219
222
public class When <T > {
220
223
221
224
private final BiFunction <TransactionOperations , ApplicationEventPublisher , T > stimulus ;
@@ -460,6 +463,7 @@ public void andVerifyEvents(Consumer<AssertablePublishedEvents> events) {
460
463
* @param eventType must not be {@literal null}.
461
464
* @return will never be {@literal null}.
462
465
*/
466
+ @ CheckReturnValue
463
467
public <E > EventResult <E > andExpect (Class <E > eventType ) {
464
468
return new EventResult <>(eventType , Function .identity (), result );
465
469
}
@@ -501,6 +505,7 @@ public class EventResult<E> {
501
505
* @param filter must not be {@literal null}.
502
506
* @return will never be {@literal null}.
503
507
*/
508
+ @ CheckReturnValue
504
509
public EventResult <E > matching (Predicate <? super E > filter ) {
505
510
506
511
Assert .notNull (filter , "Filter must not be null!" );
@@ -517,6 +522,7 @@ public EventResult<E> matching(Predicate<? super E> filter) {
517
522
* @param filter must not be {@literal null}.
518
523
* @return will never be {@literal null}.
519
524
*/
525
+ @ CheckReturnValue
520
526
public <S > EventResult <E > matchingMapped (Function <E , S > extractor , Predicate <? super S > filter ) {
521
527
return new EventResult <E >(type , createOrAdd (it -> it .matching (extractor , filter )), previousResult );
522
528
}
@@ -529,6 +535,7 @@ public <S> EventResult<E> matchingMapped(Function<E, S> extractor, Predicate<? s
529
535
* @param value can be {@literal null}.
530
536
* @return will never be {@literal null}.
531
537
*/
538
+ @ CheckReturnValue
532
539
public <S > EventResult <E > matchingMappedValue (Function <E , S > extractor , @ Nullable S value ) {
533
540
return new EventResult <E >(type , createOrAdd (it -> it .matching (extractor , value )), previousResult );
534
541
}
0 commit comments