Commit 553b1842 authored by Stephane Nicoll's avatar Stephane Nicoll

Polish "Use Supplier variants of Assert methods"

Closes gh-12630
parent 3b0f6e71
...@@ -52,8 +52,8 @@ public class HazelcastProperties { ...@@ -52,8 +52,8 @@ public class HazelcastProperties {
if (this.config == null) { if (this.config == null) {
return null; return null;
} }
Assert.isTrue(this.config.exists(), () -> "Hazelcast configuration does not exist '" Assert.isTrue(this.config.exists(), () -> "Hazelcast configuration does not "
+ this.config.getDescription() + "'"); + "exist '" + this.config.getDescription() + "'");
return this.config; return this.config;
} }
......
...@@ -124,8 +124,9 @@ abstract class ArchiveCommand extends OptionParsingCommand { ...@@ -124,8 +124,9 @@ abstract class ArchiveCommand extends OptionParsingCommand {
protected ExitStatus run(OptionSet options) throws Exception { protected ExitStatus run(OptionSet options) throws Exception {
List<?> nonOptionArguments = new ArrayList<Object>( List<?> nonOptionArguments = new ArrayList<Object>(
options.nonOptionArguments()); options.nonOptionArguments());
Assert.isTrue(nonOptionArguments.size() >= 2, () -> "The name of the resulting " Assert.isTrue(nonOptionArguments.size() >= 2, () -> "The name of the "
+ this.type + " and at least one source file must be specified"); + "resulting" + this.type + " and at least one source file must be "
+ "specified");
File output = new File((String) nonOptionArguments.remove(0)); File output = new File((String) nonOptionArguments.remove(0));
Assert.isTrue( Assert.isTrue(
......
...@@ -56,7 +56,8 @@ public class ClassLoaderFile implements Serializable { ...@@ -56,7 +56,8 @@ public class ClassLoaderFile implements Serializable {
public ClassLoaderFile(Kind kind, long lastModified, byte[] contents) { public ClassLoaderFile(Kind kind, long lastModified, byte[] contents) {
Assert.notNull(kind, "Kind must not be null"); Assert.notNull(kind, "Kind must not be null");
Assert.isTrue(kind == Kind.DELETED ? contents == null : contents != 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.kind = kind;
this.lastModified = lastModified; this.lastModified = lastModified;
this.contents = contents; this.contents = contents;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment