Use Supplier variants of Assert methods

See gh-12630
This commit is contained in:
dreis2211
2018-03-25 19:10:31 +02:00
committed by Stephane Nicoll
parent d771485efb
commit 3b0f6e7168
18 changed files with 33 additions and 30 deletions

View File

@@ -124,14 +124,14 @@ 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 "
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(
output.getName().toLowerCase(Locale.ENGLISH)
.endsWith("." + this.type),
"The output '" + output + "' is not a "
() -> "The output '" + output + "' is not a "
+ this.type.toUpperCase(Locale.ENGLISH) + " file.");
deleteIfExists(output);