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

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,7 +79,7 @@ class FolderSnapshot {
Assert.notNull(snapshot, "Snapshot must not be null");
File folder = this.folder;
Assert.isTrue(snapshot.folder.equals(folder),
"Snapshot source folder must be '" + folder + "'");
() -> "Snapshot source folder must be '" + folder + "'");
Set<ChangedFile> changes = new LinkedHashSet<>();
Map<File, FileSnapshot> previousFiles = getFilesMap();
for (FileSnapshot currentFile : snapshot.files) {

View File

@@ -111,8 +111,9 @@ public class ClassPathChangeUploader
headers.setContentLength(bytes.length);
FileCopyUtils.copy(bytes, request.getBody());
ClientHttpResponse response = request.execute();
Assert.state(response.getStatusCode() == HttpStatus.OK,
"Unexpected " + response.getStatusCode()
HttpStatus statusCode = response.getStatusCode();
Assert.state(statusCode == HttpStatus.OK,
() -> "Unexpected " + statusCode
+ " response uploading class files");
logUpload(classLoaderFiles);
return;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ 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;