Polishing

This commit is contained in:
Juergen Hoeller
2023-08-02 00:06:49 +02:00
parent ae279eaced
commit 52176edcbf
3 changed files with 17 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,6 +57,7 @@ import static org.springframework.transaction.event.TransactionPhase.BEFORE_COMM
/**
* Integration tests for {@link TransactionalEventListener} support
* with thread-bound transactions.
*
* @author Stephane Nicoll
* @author Sam Brannen
@@ -87,7 +88,6 @@ public class TransactionalEventListenerTests {
getEventCollector().assertEvents(EventCollector.IMMEDIATELY, "test");
getEventCollector().assertTotalEventsCount(1);
return null;
});
getEventCollector().assertEvents(EventCollector.IMMEDIATELY, "test");
getEventCollector().assertTotalEventsCount(1);
@@ -115,7 +115,6 @@ public class TransactionalEventListenerTests {
getContext().publishEvent("test");
getEventCollector().assertNoEventReceived();
return null;
});
getEventCollector().assertEvents(EventCollector.AFTER_COMPLETION, "test");
getEventCollector().assertTotalEventsCount(1); // After rollback not invoked
@@ -129,7 +128,6 @@ public class TransactionalEventListenerTests {
getEventCollector().assertNoEventReceived();
status.setRollbackOnly();
return null;
});
getEventCollector().assertEvents(EventCollector.AFTER_COMPLETION, "test");
getEventCollector().assertTotalEventsCount(1); // After rollback not invoked
@@ -142,7 +140,6 @@ public class TransactionalEventListenerTests {
getContext().publishEvent("test");
getEventCollector().assertNoEventReceived();
return null;
});
getEventCollector().assertEvents(EventCollector.AFTER_COMMIT, "test");
getEventCollector().assertTotalEventsCount(1); // After rollback not invoked
@@ -307,13 +304,12 @@ public class TransactionalEventListenerTests {
}
@Test
public void afterCommitMetaAnnotation() throws Exception {
public void afterCommitMetaAnnotation() {
load(AfterCommitMetaAnnotationTestListener.class);
this.transactionTemplate.execute(status -> {
getContext().publishEvent("test");
getEventCollector().assertNoEventReceived();
return null;
});
getEventCollector().assertEvents(EventCollector.AFTER_COMMIT, "test");
getEventCollector().assertTotalEventsCount(1);
@@ -326,7 +322,6 @@ public class TransactionalEventListenerTests {
getContext().publishEvent("SKIP");
getEventCollector().assertNoEventReceived();
return null;
});
getEventCollector().assertNoEventReceived();
}