Skip to content

Commit 2eba1c5

Browse files
committed
Polish "Use Assert.state() with Supplier where possible"
Closes gh-10658
1 parent 3b71393 commit 2eba1c5

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

spring-boot-project/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ private File findLaunchScript() throws IOException {
9393
}
9494
File bin = new File(unpacked.listFiles()[0], "bin");
9595
File launchScript = new File(bin, isWindows() ? "spring.bat" : "spring");
96-
Assert.state(launchScript.exists() && launchScript.isFile(),
97-
() -> "Could not find CLI launch script " + launchScript.getAbsolutePath());
96+
Assert.state(launchScript.exists() && launchScript.isFile(), () ->
97+
"Could not find CLI launch script " + launchScript.getAbsolutePath());
9898
return launchScript;
9999
}
100100

spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ private void parseSpyBeanAnnotation(SpyBean annotation, AnnotatedElement element
109109
private void addDefinition(AnnotatedElement element, Definition definition,
110110
String type) {
111111
boolean isNewDefinition = this.definitions.add(definition);
112-
Assert.state(isNewDefinition,
113-
() -> "Duplicate " + type + " definition " + definition);
112+
Assert.state(isNewDefinition, () ->
113+
"Duplicate " + type + " definition " + definition);
114114
if (element instanceof Field) {
115115
Field field = (Field) element;
116116
this.definitionFields.put(definition, field);

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationTemp.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ private File getTempDirectory() {
9191
Assert.state(StringUtils.hasLength(property), "No 'java.io.tmpdir' property set");
9292
File file = new File(property);
9393
Assert.state(file.exists(), () -> "Temp directory" + file + " does not exist");
94-
Assert.state(file.isDirectory(), () -> "Temp location " + file + " is not a directory");
94+
Assert.state(file.isDirectory(), () -> "Temp location " + file
95+
+ " is not a directory");
9596
return file;
9697
}
9798

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ private void initialize() {
9292
@Override
9393
protected void doStart() throws Exception {
9494
for (Connector connector : JettyWebServer.this.connectors) {
95-
Assert.state(connector.isStopped(), () -> "Connector " + connector
96-
+ " has been started prematurely");
95+
Assert.state(connector.isStopped(), () -> "Connector "
96+
+ connector + " has been started prematurely");
9797
}
9898
JettyWebServer.this.server.setConnectors(null);
9999
}

0 commit comments

Comments
 (0)