Browse Source

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

Closes gh-10658
pull/10657/merge
Stephane Nicoll 8 years ago
parent
commit
2eba1c5f62
  1. 4
      spring-boot-project/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java
  2. 4
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java
  3. 3
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationTemp.java
  4. 4
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java

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

@ -93,8 +93,8 @@ public final class CommandLineInvoker { @@ -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;
}

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

@ -109,8 +109,8 @@ class DefinitionsParser { @@ -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);

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

@ -91,7 +91,8 @@ public class ApplicationTemp { @@ -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;
}

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

@ -92,8 +92,8 @@ public class JettyWebServer implements WebServer { @@ -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…
Cancel
Save