Skip to content

Commit c5a7e38

Browse files
committed
Make example/spring-txn fail if transactions are not used
Also remove the @TxN annotation from see_message.feature, since it fails if transactions are used.
1 parent 1564124 commit c5a7e38

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

examples/spring-txn/src/test/java/cucumber/examples/spring/txn/UserStepdefs.java

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import org.springframework.beans.factory.annotation.Autowired;
55
import org.springframework.test.context.ContextConfiguration;
66
import org.springframework.test.context.web.WebAppConfiguration;
7+
import org.springframework.transaction.support.TransactionSynchronizationManager;
8+
9+
import static org.junit.Assert.assertTrue;
710

811
import java.util.List;
912

@@ -31,5 +34,7 @@ public void a_User_has_posted_the_following_messages(List<Message> messages) thr
3134
m.setAuthor(user);
3235
messageRepository.save(m);
3336
}
37+
assertTrue("No transaction is active",
38+
TransactionSynchronizationManager.isActualTransactionActive());
3439
}
3540
}

examples/spring-txn/src/test/resources/cucumber/examples/spring/txn/see_messages.feature

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@txn
21
Feature: See Messages
32

43
Scenario: See another user's messages

0 commit comments

Comments
 (0)