Commit 0e3d076
authored
ReplacePowerMockito: ensure mockito-core is added when PowerMock is removed (#920)
* Add failing test for missing mockito-core after PowerMock removal
When a project only has PowerMock declared and gets Mockito transitively
through powermock-api-mockito, ReplacePowerMockito removes the PowerMock
dependencies but never adds mockito-core.
Reproduces moderneinc/customer-requests#1926
* Replace PowerMock API dependency with mockito-core instead of just removing it
When a project gets Mockito only transitively through powermock-api-mockito,
RemoveDependency leaves no Mockito dependency at all. Instead of removing and
then adding (which runs into stale GradleProject marker issues with
AddDependency), use ChangeDependency to convert powermock-api-mockito directly
to mockito-core:3.x.
Handles both powermock-api-mockito (Mockito 1) and powermock-api-mockito2
(Mockito 2) artifact names.
Fixes moderneinc/customer-requests#1926
* Regenerate recipes.csv
* Add comment explaining mutual exclusivity of powermock-api-mockito artifacts1 parent af19fad commit 0e3d076
3 files changed
Lines changed: 188 additions & 67 deletions
File tree
- src
- main/resources/META-INF/rewrite
- test/java/org/openrewrite/java/testing/mockito
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
52 | 63 | | |
53 | 64 | | |
54 | 65 | | |
0 commit comments