Polish "Use Assert.state() with Supplier where possible"

Closes gh-10658
This commit is contained in:
Stephane Nicoll 2017-10-17 15:36:51 +02:00
parent 3b71393e0a
commit 2eba1c5f62
4 changed files with 8 additions and 7 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

View 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);
}