Polish "Use Supplier variants of Assert methods"

Closes gh-12630
pull/12638/merge
Stephane Nicoll 7 years ago
parent 3b0f6e7168
commit 553b184248

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

@ -124,8 +124,9 @@ abstract class ArchiveCommand extends OptionParsingCommand {
protected ExitStatus run(OptionSet options) throws Exception {
List<?> nonOptionArguments = new ArrayList<Object>(
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(

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

Loading…
Cancel
Save