@@ -81,8 +81,6 @@ void verifyTransactionSynchronizationManagerState() {
81
81
82
82
@ Test
83
83
void testTransactionCommit () {
84
- given (manager .getTransaction ()).willReturn (tx );
85
-
86
84
final List <String > l = new ArrayList <>();
87
85
l .add ("test" );
88
86
@@ -106,7 +104,6 @@ void testTransactionCommit() {
106
104
107
105
@ Test
108
106
void testTransactionCommitWithRollbackException () {
109
- given (manager .getTransaction ()).willReturn (tx );
110
107
given (tx .getRollbackOnly ()).willReturn (true );
111
108
willThrow (new RollbackException ()).given (tx ).commit ();
112
109
@@ -138,7 +135,6 @@ void testTransactionCommitWithRollbackException() {
138
135
139
136
@ Test
140
137
void testTransactionRollback () {
141
- given (manager .getTransaction ()).willReturn (tx );
142
138
given (tx .isActive ()).willReturn (true );
143
139
144
140
final List <String > l = new ArrayList <>();
@@ -163,8 +159,6 @@ void testTransactionRollback() {
163
159
164
160
@ Test
165
161
void testTransactionRollbackWithAlreadyRolledBack () {
166
- given (manager .getTransaction ()).willReturn (tx );
167
-
168
162
final List <String > l = new ArrayList <>();
169
163
l .add ("test" );
170
164
@@ -186,7 +180,6 @@ void testTransactionRollbackWithAlreadyRolledBack() {
186
180
187
181
@ Test
188
182
void testTransactionRollbackOnly () {
189
- given (manager .getTransaction ()).willReturn (tx );
190
183
given (tx .isActive ()).willReturn (true );
191
184
192
185
final List <String > l = new ArrayList <>();
@@ -214,8 +207,6 @@ void testTransactionRollbackOnly() {
214
207
215
208
@ Test
216
209
void testParticipatingTransactionWithCommit () {
217
- given (manager .getTransaction ()).willReturn (tx );
218
-
219
210
final List <String > l = new ArrayList <>();
220
211
l .add ("test" );
221
212
@@ -241,7 +232,6 @@ void testParticipatingTransactionWithCommit() {
241
232
242
233
@ Test
243
234
void testParticipatingTransactionWithRollback () {
244
- given (manager .getTransaction ()).willReturn (tx );
245
235
given (tx .isActive ()).willReturn (true );
246
236
247
237
final List <String > l = new ArrayList <>();
@@ -269,7 +259,6 @@ void testParticipatingTransactionWithRollback() {
269
259
270
260
@ Test
271
261
void testParticipatingTransactionWithRollbackOnly () {
272
- given (manager .getTransaction ()).willReturn (tx );
273
262
given (tx .isActive ()).willReturn (true );
274
263
given (tx .getRollbackOnly ()).willReturn (true );
275
264
willThrow (new RollbackException ()).given (tx ).commit ();
@@ -304,10 +293,6 @@ void testParticipatingTransactionWithRollbackOnly() {
304
293
void testParticipatingTransactionWithRequiresNew () {
305
294
tt .setPropagationBehavior (TransactionDefinition .PROPAGATION_REQUIRES_NEW );
306
295
307
- given (factory .createEntityManager ()).willReturn (manager );
308
- given (manager .getTransaction ()).willReturn (tx );
309
- given (manager .isOpen ()).willReturn (true );
310
-
311
296
final List <String > l = new ArrayList <>();
312
297
l .add ("test" );
313
298
@@ -335,7 +320,6 @@ void testParticipatingTransactionWithRequiresNew() {
335
320
void testParticipatingTransactionWithRequiresNewAndPrebound () {
336
321
tt .setPropagationBehavior (TransactionDefinition .PROPAGATION_REQUIRES_NEW );
337
322
338
- given (manager .getTransaction ()).willReturn (tx );
339
323
340
324
final List <String > l = new ArrayList <>();
341
325
l .add ("test" );
@@ -374,8 +358,6 @@ void testParticipatingTransactionWithRequiresNewAndPrebound() {
374
358
void testPropagationSupportsAndRequiresNew () {
375
359
tt .setPropagationBehavior (TransactionDefinition .PROPAGATION_SUPPORTS );
376
360
377
- given (manager .getTransaction ()).willReturn (tx );
378
-
379
361
final List <String > l = new ArrayList <>();
380
362
l .add ("test" );
381
363
@@ -405,10 +387,6 @@ void testPropagationSupportsAndRequiresNew() {
405
387
void testPropagationSupportsAndRequiresNewAndEarlyAccess () {
406
388
tt .setPropagationBehavior (TransactionDefinition .PROPAGATION_SUPPORTS );
407
389
408
- given (factory .createEntityManager ()).willReturn (manager );
409
- given (manager .getTransaction ()).willReturn (tx );
410
- given (manager .isOpen ()).willReturn (true );
411
-
412
390
final List <String > l = new ArrayList <>();
413
391
l .add ("test" );
414
392
@@ -443,7 +421,6 @@ void testTransactionWithRequiresNewInAfterCompletion() {
443
421
EntityManager manager2 = mock ();
444
422
EntityTransaction tx2 = mock ();
445
423
446
- given (manager .getTransaction ()).willReturn (tx );
447
424
given (factory .createEntityManager ()).willReturn (manager , manager2 );
448
425
given (manager2 .getTransaction ()).willReturn (tx2 );
449
426
given (manager2 .isOpen ()).willReturn (true );
@@ -479,8 +456,6 @@ public void afterCompletion(int status) {
479
456
480
457
@ Test
481
458
void testTransactionCommitWithPropagationSupports () {
482
- given (manager .isOpen ()).willReturn (true );
483
-
484
459
final List <String > l = new ArrayList <>();
485
460
l .add ("test" );
486
461
@@ -507,8 +482,6 @@ void testTransactionCommitWithPropagationSupports() {
507
482
508
483
@ Test
509
484
void testTransactionRollbackWithPropagationSupports () {
510
- given (manager .isOpen ()).willReturn (true );
511
-
512
485
tt .setPropagationBehavior (TransactionDefinition .PROPAGATION_SUPPORTS );
513
486
514
487
assertThat (TransactionSynchronizationManager .hasResource (factory )).isFalse ();
@@ -532,8 +505,6 @@ void testTransactionRollbackWithPropagationSupports() {
532
505
533
506
@ Test
534
507
void testTransactionCommitWithPrebound () {
535
- given (manager .getTransaction ()).willReturn (tx );
536
-
537
508
final List <String > l = new ArrayList <>();
538
509
l .add ("test" );
539
510
@@ -563,7 +534,6 @@ void testTransactionCommitWithPrebound() {
563
534
564
535
@ Test
565
536
void testTransactionRollbackWithPrebound () {
566
- given (manager .getTransaction ()).willReturn (tx );
567
537
given (tx .isActive ()).willReturn (true );
568
538
569
539
assertThat (TransactionSynchronizationManager .hasResource (factory )).isFalse ();
@@ -655,8 +625,6 @@ void testTransactionRollbackWithPreboundAndPropagationSupports() {
655
625
void testInvalidIsolation () {
656
626
tt .setIsolationLevel (TransactionDefinition .ISOLATION_SERIALIZABLE );
657
627
658
- given (manager .isOpen ()).willReturn (true );
659
-
660
628
assertThatExceptionOfType (InvalidIsolationLevelException .class ).isThrownBy (() ->
661
629
tt .execute (new TransactionCallbackWithoutResult () {
662
630
@ Override
@@ -669,8 +637,6 @@ protected void doInTransactionWithoutResult(TransactionStatus status) {
669
637
670
638
@ Test
671
639
void testTransactionFlush () {
672
- given (manager .getTransaction ()).willReturn (tx );
673
-
674
640
assertThat (TransactionSynchronizationManager .hasResource (factory )).isFalse ();
675
641
assertThat (TransactionSynchronizationManager .isSynchronizationActive ()).isFalse ();
676
642
0 commit comments