Use Supplier variants of Assert methods
See gh-12630
This commit is contained in:
committed by
Stephane Nicoll
parent
d771485efb
commit
3b0f6e7168
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user