Commit af19fad
authored
Detect JUnit version in PowerMockitoMockStaticToMockito (#919)
* Add failing test for JUnit 4 PowerMockito migration
Reproduces moderneinc/customer-requests#1925: when a test class uses
JUnit 4 (@org.junit.Test), ReplacePowerMockito should use @Before/@after
instead of @BeforeEach/@AfterEach.
* Detect JUnit version in PowerMockitoMockStaticToMockito
When a test class uses JUnit 4 (@org.junit.Test), the recipe now
uses @Before/@after from org.junit instead of always defaulting to
@BeforeEach/@AfterEach from JUnit Jupiter.
Fixes moderneinc/customer-requests#19251 parent c2860b4 commit af19fad
2 files changed
Lines changed: 74 additions & 15 deletions
File tree
- src
- main/java/org/openrewrite/java/testing/mockito
- test/java/org/openrewrite/java/testing/mockito
Lines changed: 16 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
358 | 359 | | |
359 | 360 | | |
360 | 361 | | |
361 | | - | |
| 362 | + | |
362 | 363 | | |
363 | 364 | | |
364 | 365 | | |
365 | 366 | | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
| 367 | + | |
372 | 368 | | |
373 | 369 | | |
374 | 370 | | |
375 | 371 | | |
376 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
377 | 385 | | |
378 | 386 | | |
379 | 387 | | |
| |||
Lines changed: 58 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
654 | 654 | | |
655 | 655 | | |
656 | 656 | | |
| 657 | + | |
657 | 658 | | |
658 | 659 | | |
659 | | - | |
660 | | - | |
661 | 660 | | |
662 | 661 | | |
663 | 662 | | |
| |||
670 | 669 | | |
671 | 670 | | |
672 | 671 | | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | 672 | | |
678 | 673 | | |
679 | 674 | | |
680 | | - | |
| 675 | + | |
681 | 676 | | |
682 | 677 | | |
683 | 678 | | |
| |||
772 | 767 | | |
773 | 768 | | |
774 | 769 | | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
775 | 826 | | |
0 commit comments