-
Notifications
You must be signed in to change notification settings - Fork 53
/
junit5.yml
executable file
·188 lines (187 loc) · 7.44 KB
/
junit5.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#
# Copyright 2021 the original author or authors.
# <p>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# <p>
# https://www.apache.org/licenses/LICENSE-2.0
# <p>
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.testing.junit5.JUnit5BestPractices
displayName: JUnit Jupiter best practices
description: Applies best practices to tests.
tags:
- testing
- junit
recipeList:
- org.openrewrite.java.testing.junit5.StaticImports
- org.openrewrite.java.testing.junit5.JUnit4to5Migration
- org.openrewrite.java.testing.junit5.CleanupAssertions
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.testing.junit5.StaticImports
displayName: Statically import JUnit Jupiter assertions
description: Always use a static import for assertion methods.
tags:
- testing
- junit
recipeList:
- org.openrewrite.java.UseStaticImport:
methodPattern: "org.junit.jupiter.api.Assertions *(..)"
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.testing.junit5.JUnit4to5Migration
displayName: JUnit Jupiter migration from JUnit 4.x
description: Migrates JUnit 4.x tests to JUnit Jupiter.
tags:
- testing
- junit
recipeList:
- org.openrewrite.java.testing.junit5.UseWiremockExtension
- org.openrewrite.java.testing.junit5.IgnoreToDisabled
- org.openrewrite.java.ReorderMethodArguments:
methodPattern: org.junit.Assume assume*(String, boolean)
oldParameterNames:
- message
- b
newParameterNames:
- b
- message
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.junit.Assume
newFullyQualifiedTypeName: org.junit.jupiter.api.Assumptions
- org.openrewrite.java.testing.junit5.RemoveObsoleteRunners:
obsoleteRunners:
- org.junit.runners.JUnit4
- org.junit.runners.BlockJUnit4ClassRunner
- org.openrewrite.java.testing.junit5.UseHamcrestAssertThat
- org.openrewrite.java.testing.junit5.UseMockitoExtension
- org.openrewrite.java.testing.junit5.UseTestMethodOrder
- org.openrewrite.java.testing.junit5.MigrateJUnitTestCase
- org.openrewrite.java.testing.junit5.AssertToAssertions
- org.openrewrite.java.testing.junit5.CategoryToTag
- org.openrewrite.java.testing.junit5.CleanupJUnitImports
- org.openrewrite.java.testing.junit5.TemporaryFolderToTempDir
- org.openrewrite.java.testing.junit5.TempDirNonFinal
- org.openrewrite.java.testing.junit5.TestRuleToTestInfo
- org.openrewrite.java.testing.junit5.UpdateBeforeAfterAnnotations
- org.openrewrite.java.testing.junit5.LifecycleNonPrivate
- org.openrewrite.java.testing.junit5.UpdateTestAnnotation
- org.openrewrite.java.testing.junit5.ParameterizedRunnerToParameterized
- org.openrewrite.java.testing.junit5.JUnitParamsRunnerToParameterized
- org.openrewrite.java.testing.junit5.ExpectedExceptionToAssertThrows
- org.openrewrite.java.testing.junit5.UpdateMockWebServer
- org.openrewrite.java.testing.junit5.VertxUnitToVertxJunit5
- org.openrewrite.java.testing.junit5.EnclosedToNested
- org.openrewrite.java.testing.junit5.AddMissingNested
- org.openrewrite.java.testing.hamcrest.AddHamcrestIfUsed
- org.openrewrite.maven.RemoveDependency:
groupId: junit
artifactId: junit
- org.openrewrite.maven.ExcludeDependency:
groupId: junit
artifactId: junit
- org.openrewrite.maven.RemoveDependency:
groupId: org.junit.vintage
artifactId: junit-vintage-engine
- org.openrewrite.maven.ExcludeDependency:
groupId: org.junit.vintage
artifactId: junit-vintage-engine
- org.openrewrite.maven.AddDependency:
groupId: org.junit.jupiter
artifactId: junit-jupiter
version: 5.x
onlyIfUsing: org.junit.jupiter.api.Test
- org.openrewrite.maven.AddDependency:
groupId: org.junit.jupiter
artifactId: junit-jupiter-params
version: 5.x
onlyIfUsing: org.junit.jupiter.params.ParameterizedTest
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.testing.junit5.UseHamcrestAssertThat
displayName: Use `MatcherAssert#assertThat(..)`
description: JUnit 4's `Assert#assertThat(..)` This method was deprecated in JUnit 4 and removed in JUnit Jupiter.
tags:
- testing
- junit
- hamcrest
recipeList:
- org.openrewrite.java.ChangeMethodTargetToStatic:
methodPattern: org.junit.Assert assertThat(..)
fullyQualifiedTargetTypeName: org.hamcrest.MatcherAssert
- org.openrewrite.java.UseStaticImport:
methodPattern: org.hamcrest.MatcherAssert assertThat(..)
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.testing.junit5.UseMockitoExtension
displayName: Use Mockito JUnit Jupiter extension
description: Migrate uses of `@RunWith(MockitoJUnitRunner.class)` (and similar annotations) to `@ExtendWith(MockitoExtension.class)`.
tags:
- testing
- junit
- mockito
recipeList:
- org.openrewrite.java.testing.mockito.Mockito1to4Migration
- org.openrewrite.java.testing.mockito.MockitoJUnitRunnerSilentToExtension
- org.openrewrite.java.testing.junit5.RunnerToExtension:
runners:
- org.mockito.runners.MockitoJUnitRunner
- org.mockito.junit.MockitoJUnitRunner
- org.mockito.runners.MockitoJUnit44Runner
- org.mockito.junit.MockitoJUnit44Runner
extension: org.mockito.junit.jupiter.MockitoExtension
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.testing.junit5.IgnoreToDisabled
displayName: Use JUnit Jupiter `@Disabled`
description: Migrates JUnit 4.x `@Ignore` to JUnit Jupiter `@Disabled`.
tags:
- testing
- junit
recipeList:
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.junit.Ignore
newFullyQualifiedTypeName: org.junit.jupiter.api.Disabled
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.testing.junit5.VertxUnitToVertxJunit5
displayName: Use Vertx JUnit 5 Extension
description: Migrates Vertx `@RunWith` `VertxUnitRunner` to the JUnit Jupiter `@ExtendWith` `VertxExtension`.
tags:
- testing
- junit
recipeList:
- org.openrewrite.java.testing.junit5.RunnerToExtension:
runners:
- org.vertx.testtools.VertxUnitRunner
extension: org.vertx.testtools.VertxExtension
- org.openrewrite.maven.AddDependency:
groupId: io.vertx
artifactId: vertx-junit5
version: 4.x
onlyIfUsing: io.vertx.junit5.VertxExtension
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.testing.junit5.CleanupAssertions
displayName: Clean Up Assertions
description: Simplifies JUnit Jupiter assertions to their most-direct equivalents
tags:
- testing
- junit
recipeList:
- org.openrewrite.java.testing.cleanup.AssertTrueNegationToAssertFalse
- org.openrewrite.java.testing.cleanup.AssertFalseNegationToAssertTrue
- org.openrewrite.java.testing.cleanup.AssertTrueEqualsToAssertEquals
- org.openrewrite.java.testing.cleanup.AssertTrueComparisonToAssertEquals
- org.openrewrite.java.testing.cleanup.AssertFalseEqualsToAssertNotEquals
- org.openrewrite.java.testing.cleanup.AssertEqualsNullToAssertNull
- org.openrewrite.java.testing.cleanup.AssertFalseNullToAssertNotNull