Polish "Use Assert.state() with Supplier where possible"
Closes gh-10658
This commit is contained in:
parent
3b71393e0a
commit
2eba1c5f62
|
|
@ -93,8 +93,8 @@ public final class CommandLineInvoker {
|
|||
}
|
||||
File bin = new File(unpacked.listFiles()[0], "bin");
|
||||
File launchScript = new File(bin, isWindows() ? "spring.bat" : "spring");
|
||||
Assert.state(launchScript.exists() && launchScript.isFile(),
|
||||
() -> "Could not find CLI launch script " + launchScript.getAbsolutePath());
|
||||
Assert.state(launchScript.exists() && launchScript.isFile(), () ->
|
||||
"Could not find CLI launch script " + launchScript.getAbsolutePath());
|
||||
return launchScript;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,8 +109,8 @@ class DefinitionsParser {
|
|||
private void addDefinition(AnnotatedElement element, Definition definition,
|
||||
String type) {
|
||||
boolean isNewDefinition = this.definitions.add(definition);
|
||||
Assert.state(isNewDefinition,
|
||||
() -> "Duplicate " + type + " definition " + definition);
|
||||
Assert.state(isNewDefinition, () ->
|
||||
"Duplicate " + type + " definition " + definition);
|
||||
if (element instanceof Field) {
|
||||
Field field = (Field) element;
|
||||
this.definitionFields.put(definition, field);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@ public class ApplicationTemp {
|
|||
Assert.state(StringUtils.hasLength(property), "No 'java.io.tmpdir' property set");
|
||||
File file = new File(property);
|
||||
Assert.state(file.exists(), () -> "Temp directory" + file + " does not exist");
|
||||
Assert.state(file.isDirectory(), () -> "Temp location " + file + " is not a directory");
|
||||
Assert.state(file.isDirectory(), () -> "Temp location " + file
|
||||
+ " is not a directory");
|
||||
return file;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ public class JettyWebServer implements WebServer {
|
|||
@Override
|
||||
protected void doStart() throws Exception {
|
||||
for (Connector connector : JettyWebServer.this.connectors) {
|
||||
Assert.state(connector.isStopped(), () -> "Connector " + connector
|
||||
+ " has been started prematurely");
|
||||
Assert.state(connector.isStopped(), () -> "Connector "
|
||||
+ connector + " has been started prematurely");
|
||||
}
|
||||
JettyWebServer.this.server.setConnectors(null);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue