Skip to content

Commit a6ffd97

Browse files
committed
Polish ArchitectureCheckTests
Signed-off-by: Dmytro Nosan <[email protected]>
1 parent 1262223 commit a6ffd97

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

buildSrc/src/test/java/org/springframework/boot/build/architecture/ArchitectureCheckTests.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void whenPackagesAreTangledShouldFailAndWriteReport(Task task) throws IOExceptio
7373

7474
@ParameterizedTest(name = "{0}")
7575
@EnumSource(Task.class)
76-
void whenPackagesAreNotTangledShouldNotFail(Task task) throws IOException {
76+
void whenPackagesAreNotTangledShouldSucceedAndWriteEmptyReport(Task task) throws IOException {
7777
prepareTask(task, "untangled");
7878
build(this.gradleBuild, task);
7979
}
@@ -99,14 +99,16 @@ void whenBeanPostProcessorBeanMethodIsStaticAndHasUnsafeParametersShouldFailAndW
9999

100100
@ParameterizedTest(name = "{0}")
101101
@EnumSource(Task.class)
102-
void whenBeanPostProcessorBeanMethodIsStaticAndHasSafeParametersShouldNotFail(Task task) throws IOException {
102+
void whenBeanPostProcessorBeanMethodIsStaticAndHasSafeParametersShouldSucceedAndWriteEmptyReport(Task task)
103+
throws IOException {
103104
prepareTask(task, "bpp/safeparameters");
104105
build(this.gradleBuild.withDependencies(SPRING_CONTEXT), task);
105106
}
106107

107108
@ParameterizedTest(name = "{0}")
108109
@EnumSource(Task.class)
109-
void whenBeanPostProcessorBeanMethodIsStaticAndHasNoParametersShouldNotFail(Task task) throws IOException {
110+
void whenBeanPostProcessorBeanMethodIsStaticAndHasNoParametersShouldSucceedAndWriteEmptyReport(Task task)
111+
throws IOException {
110112
prepareTask(task, "bpp/noparameters");
111113
build(this.gradleBuild.withDependencies(SPRING_CONTEXT), task);
112114
}
@@ -132,7 +134,8 @@ void whenBeanFactoryPostProcessorBeanMethodIsStaticAndHasParametersShouldFailAnd
132134

133135
@ParameterizedTest(name = "{0}")
134136
@EnumSource(Task.class)
135-
void whenBeanFactoryPostProcessorBeanMethodIsStaticAndHasNoParametersShouldNotFail(Task task) throws IOException {
137+
void whenBeanFactoryPostProcessorBeanMethodIsStaticAndHasNoParametersShouldSucceedAndWriteEmptyReport(Task task)
138+
throws IOException {
136139
prepareTask(task, "bfpp/noparameters");
137140
build(this.gradleBuild.withDependencies(SPRING_CONTEXT), task);
138141
}
@@ -148,14 +151,15 @@ void whenClassLoadsResourceUsingResourceUtilsShouldFailAndWriteReport(Task task)
148151

149152
@ParameterizedTest(name = "{0}")
150153
@EnumSource(Task.class)
151-
void whenClassUsesResourceUtilsWithoutLoadingResourcesShouldNotFail(Task task) throws IOException {
154+
void whenClassUsesResourceUtilsWithoutLoadingResourcesShouldSucceedAndWriteEmptyReport(Task task)
155+
throws IOException {
152156
prepareTask(task, "resources/noloads");
153157
build(this.gradleBuild.withDependencies(SPRING_CONTEXT), task);
154158
}
155159

156160
@ParameterizedTest(name = "{0}")
157161
@EnumSource(Task.class)
158-
void whenClassDoesNotCallObjectsRequireNonNullShouldNotFail(Task task) throws IOException {
162+
void whenClassDoesNotCallObjectsRequireNonNullShouldSucceedAndWriteEmptyReport(Task task) throws IOException {
159163
prepareTask(task, "objects/noRequireNonNull");
160164
build(this.gradleBuild.withDependencies(SPRING_CONTEXT), task);
161165
}
@@ -169,8 +173,8 @@ void whenClassCallsObjectsRequireNonNullWithMessageShouldFailAndWriteReport(Task
169173

170174
@ParameterizedTest(name = "{0}")
171175
@EnumSource(Task.class)
172-
void whenClassCallsObjectsRequireNonNullWithMessageAndProhibitObjectsRequireNonNullIsFalseShouldNotFail(Task task)
173-
throws IOException {
176+
void whenClassCallsObjectsRequireNonNullWithMessageAndProhibitObjectsRequireNonNullIsFalseShouldSucceedAndWriteEmptyReport(
177+
Task task) throws IOException {
174178
prepareTask(task, "objects/requireNonNullWithString");
175179
build(this.gradleBuild.withBuildFileCustomizer((builder) -> {
176180
builder.append("tasks.named('").append(task).append("') {\n");
@@ -188,8 +192,8 @@ void whenClassCallsObjectsRequireNonNullWithSupplierShouldFailAndWriteReport(Tas
188192

189193
@ParameterizedTest(name = "{0}")
190194
@EnumSource(Task.class)
191-
void whenClassCallsObjectsRequireNonNullWithSupplierAndProhibitObjectsRequireNonNullIsFalseShouldNotFail(Task task)
192-
throws IOException {
195+
void whenClassCallsObjectsRequireNonNullWithSupplierAndProhibitObjectsRequireNonNullIsFalseShouldSucceedAndWriteEmptyReport(
196+
Task task) throws IOException {
193197
prepareTask(task, "objects/requireNonNullWithSupplier");
194198
build(this.gradleBuild.withBuildFileCustomizer((builder) -> {
195199
builder.append("tasks.named('").append(task).append("') {\n");
@@ -214,14 +218,14 @@ void whenClassCallsStringToLowerCaseWithoutLocaleShouldFailAndWriteReport(Task t
214218

215219
@ParameterizedTest(name = "{0}")
216220
@EnumSource(Task.class)
217-
void whenClassCallsStringToLowerCaseWithLocaleShouldNotFail(Task task) throws IOException {
221+
void whenClassCallsStringToLowerCaseWithLocaleShouldSucceedAndWriteEmptyReport(Task task) throws IOException {
218222
prepareTask(task, "string/toLowerCaseWithLocale");
219223
build(this.gradleBuild, task);
220224
}
221225

222226
@ParameterizedTest(name = "{0}")
223227
@EnumSource(Task.class)
224-
void whenClassCallsStringToUpperCaseWithLocaleShouldNotFail(Task task) throws IOException {
228+
void whenClassCallsStringToUpperCaseWithLocaleShouldSucceedAndWriteEmptyReport(Task task) throws IOException {
225229
prepareTask(task, "string/toUpperCaseWithLocale");
226230
build(this.gradleBuild, task);
227231
}
@@ -260,14 +264,14 @@ void whenBeanMethodExposesPrivateTypeWithMainSourcesShouldFailAndWriteReport() t
260264
}
261265

262266
@Test
263-
void whenBeanMethodExposesPrivateTypeWithTestsSourcesShouldNotFail() throws IOException {
267+
void whenBeanMethodExposesPrivateTypeWithTestsSourcesShouldSucceedAndWriteEmptyReport() throws IOException {
264268
prepareTask(Task.CHECK_ARCHITECTURE_TEST, "beans/privatebean");
265269
build(this.gradleBuild.withDependencies(SPRING_CONTEXT), Task.CHECK_ARCHITECTURE_TEST);
266270
}
267271

268272
@ParameterizedTest(name = "{0}")
269273
@EnumSource(Task.class)
270-
void whenBeanMethodExposesNonPrivateTypeShouldNotFail(Task task) throws IOException {
274+
void whenBeanMethodExposesNonPrivateTypeShouldSucceedAndWriteEmptyReport(Task task) throws IOException {
271275
prepareTask(task, "beans/regular");
272276
build(this.gradleBuild.withDependencies(SPRING_CONTEXT), task);
273277
}

0 commit comments

Comments
 (0)