From 553b184248523e03df3b08db571d16c56a69d1bf Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 26 Mar 2018 17:59:35 +0200 Subject: [PATCH] Polish "Use Supplier variants of Assert methods" Closes gh-12630 --- .../boot/autoconfigure/hazelcast/HazelcastProperties.java | 4 ++-- .../boot/cli/command/archive/ArchiveCommand.java | 5 +++-- .../boot/devtools/restart/classloader/ClassLoaderFile.java | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastProperties.java index bf5fec8c982..45d5930081b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastProperties.java @@ -52,8 +52,8 @@ public class HazelcastProperties { if (this.config == null) { return null; } - Assert.isTrue(this.config.exists(), () -> "Hazelcast configuration does not exist '" - + this.config.getDescription() + "'"); + Assert.isTrue(this.config.exists(), () -> "Hazelcast configuration does not " + + "exist '" + this.config.getDescription() + "'"); return this.config; } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java index a61eea16afb..eced4919e59 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java @@ -124,8 +124,9 @@ abstract class ArchiveCommand extends OptionParsingCommand { protected ExitStatus run(OptionSet options) throws Exception { List nonOptionArguments = new ArrayList( options.nonOptionArguments()); - Assert.isTrue(nonOptionArguments.size() >= 2, () -> "The name of the resulting " - + this.type + " and at least one source file must be specified"); + Assert.isTrue(nonOptionArguments.size() >= 2, () -> "The name of the " + + "resulting" + this.type + " and at least one source file must be " + + "specified"); File output = new File((String) nonOptionArguments.remove(0)); Assert.isTrue( diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFile.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFile.java index b6aff273fce..101f4d66a94 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFile.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFile.java @@ -56,7 +56,8 @@ public class ClassLoaderFile implements Serializable { public ClassLoaderFile(Kind kind, long lastModified, byte[] contents) { Assert.notNull(kind, "Kind must not be null"); Assert.isTrue(kind == Kind.DELETED ? contents == null : contents != null, - () -> "Contents must " + (kind == Kind.DELETED ? "" : "not ") + "be null"); + () -> "Contents must " + (kind == Kind.DELETED ? "" : "not ") + + "be null"); this.kind = kind; this.lastModified = lastModified; this.contents = contents;