Use consistent exception messages in Assert calls

Update `Assert` calls to consistently use messages of the form
"'item' must [not] ...".

Closes gh-43780
This commit is contained in:
Phillip Webb
2025-01-09 15:33:44 -08:00
parent f08188d5cf
commit a49719d73e
559 changed files with 2001 additions and 2003 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2025 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.
@@ -32,7 +32,7 @@ public class TriggerFileFilter implements FileFilter {
private final String name;
public TriggerFileFilter(String name) {
Assert.notNull(name, "Name must not be null");
Assert.notNull(name, "'name' must not be null");
this.name = name;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -46,7 +46,7 @@ public class ClassPathChangedEvent extends ApplicationEvent {
*/
public ClassPathChangedEvent(Object source, Set<ChangedFiles> changeSet, boolean restartRequired) {
super(source);
Assert.notNull(changeSet, "ChangeSet must not be null");
Assert.notNull(changeSet, "'changeSet' must not be null");
this.changeSet = changeSet;
this.restartRequired = restartRequired;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2025 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.
@@ -50,8 +50,8 @@ class ClassPathFileChangeListener implements FileChangeListener {
*/
ClassPathFileChangeListener(ApplicationEventPublisher eventPublisher, ClassPathRestartStrategy restartStrategy,
FileSystemWatcher fileSystemWatcherToStop) {
Assert.notNull(eventPublisher, "EventPublisher must not be null");
Assert.notNull(restartStrategy, "RestartStrategy must not be null");
Assert.notNull(eventPublisher, "'eventPublisher' must not be null");
Assert.notNull(restartStrategy, "'restartStrategy' must not be null");
this.eventPublisher = eventPublisher;
this.restartStrategy = restartStrategy;
this.fileSystemWatcherToStop = fileSystemWatcherToStop;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2025 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.
@@ -54,8 +54,8 @@ public class ClassPathFileSystemWatcher implements InitializingBean, DisposableB
*/
public ClassPathFileSystemWatcher(FileSystemWatcherFactory fileSystemWatcherFactory,
ClassPathRestartStrategy restartStrategy, URL[] urls) {
Assert.notNull(fileSystemWatcherFactory, "FileSystemWatcherFactory must not be null");
Assert.notNull(urls, "Urls must not be null");
Assert.notNull(fileSystemWatcherFactory, "'fileSystemWatcherFactory' must not be null");
Assert.notNull(urls, "'urls' must not be null");
this.fileSystemWatcher = fileSystemWatcherFactory.getFileSystemWatcher();
this.restartStrategy = restartStrategy;
this.fileSystemWatcher.addSourceDirectories(new ClassPathDirectories(urls));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2025 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.
@@ -43,9 +43,9 @@ public final class ChangedFile {
* @param type the type of change
*/
public ChangedFile(File sourceDirectory, File file, Type type) {
Assert.notNull(sourceDirectory, "SourceDirectory must not be null");
Assert.notNull(file, "File must not be null");
Assert.notNull(type, "Type must not be null");
Assert.notNull(sourceDirectory, "'sourceDirectory' must not be null");
Assert.notNull(file, "'file' must not be null");
Assert.notNull(type, "'type' must not be null");
this.sourceDirectory = sourceDirectory;
this.file = file;
this.type = type;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2025 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.
@@ -50,8 +50,8 @@ class DirectorySnapshot {
* @param directory the source directory
*/
DirectorySnapshot(File directory) {
Assert.notNull(directory, "Directory must not be null");
Assert.isTrue(!directory.isFile(), () -> "Directory '" + directory + "' must not be a file");
Assert.notNull(directory, "'directory' must not be null");
Assert.isTrue(!directory.isFile(), () -> "'directory' [%s] must not be a file".formatted(directory));
this.directory = directory;
this.time = new Date();
Set<FileSnapshot> files = new LinkedHashSet<>();
@@ -74,10 +74,10 @@ class DirectorySnapshot {
}
ChangedFiles getChangedFiles(DirectorySnapshot snapshot, FileFilter triggerFilter) {
Assert.notNull(snapshot, "Snapshot must not be null");
Assert.notNull(snapshot, "'snapshot' must not be null");
File directory = this.directory;
Assert.isTrue(snapshot.directory.equals(directory),
() -> "Snapshot source directory must be '" + directory + "'");
() -> "'snapshot' source directory must be '" + directory + "'");
Set<ChangedFile> changes = new LinkedHashSet<>();
Map<File, FileSnapshot> previousFiles = getFilesMap();
for (FileSnapshot currentFile : snapshot.files) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2025 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.
@@ -36,8 +36,8 @@ class FileSnapshot {
private final long lastModified;
FileSnapshot(File file) {
Assert.notNull(file, "File must not be null");
Assert.isTrue(file.isFile() || !file.exists(), "File must not be a directory");
Assert.notNull(file, "'file' must not be null");
Assert.isTrue(file.isFile() || !file.exists(), () -> "'file' [%s] must be a normal file".formatted(file));
this.file = file;
this.exists = file.exists();
this.length = file.length();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -95,12 +95,12 @@ public class FileSystemWatcher {
*/
public FileSystemWatcher(boolean daemon, Duration pollInterval, Duration quietPeriod,
SnapshotStateRepository snapshotStateRepository) {
Assert.notNull(pollInterval, "PollInterval must not be null");
Assert.notNull(quietPeriod, "QuietPeriod must not be null");
Assert.isTrue(pollInterval.toMillis() > 0, "PollInterval must be positive");
Assert.isTrue(quietPeriod.toMillis() > 0, "QuietPeriod must be positive");
Assert.notNull(pollInterval, "'pollInterval' must not be null");
Assert.notNull(quietPeriod, "'quietPeriod' must not be null");
Assert.isTrue(pollInterval.toMillis() > 0, "'pollInterval' must be positive");
Assert.isTrue(quietPeriod.toMillis() > 0, "'quietPeriod' must be positive");
Assert.isTrue(pollInterval.toMillis() > quietPeriod.toMillis(),
"PollInterval must be greater than QuietPeriod");
"'pollInterval' must be greater than QuietPeriod");
this.daemon = daemon;
this.pollInterval = pollInterval.toMillis();
this.quietPeriod = quietPeriod.toMillis();
@@ -114,7 +114,7 @@ public class FileSystemWatcher {
* @param fileChangeListener the listener to add
*/
public void addListener(FileChangeListener fileChangeListener) {
Assert.notNull(fileChangeListener, "FileChangeListener must not be null");
Assert.notNull(fileChangeListener, "'fileChangeListener' must not be null");
synchronized (this.monitor) {
checkNotStarted();
this.listeners.add(fileChangeListener);
@@ -127,7 +127,7 @@ public class FileSystemWatcher {
* @param directories the directories to monitor
*/
public void addSourceDirectories(Iterable<File> directories) {
Assert.notNull(directories, "Directories must not be null");
Assert.notNull(directories, "'directories' must not be null");
synchronized (this.monitor) {
directories.forEach(this::addSourceDirectory);
}
@@ -139,8 +139,8 @@ public class FileSystemWatcher {
* @param directory the directory to monitor
*/
public void addSourceDirectory(File directory) {
Assert.notNull(directory, "Directory must not be null");
Assert.isTrue(!directory.isFile(), () -> "Directory '" + directory + "' must not be a file");
Assert.notNull(directory, "'directory' must not be null");
Assert.isTrue(!directory.isFile(), () -> "'directory' [%s] must not be a file".formatted(directory));
synchronized (this.monitor) {
checkNotStarted();
this.directories.put(directory, null);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2025 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.
@@ -40,13 +40,13 @@ class Frame {
* @param payload the text payload
*/
Frame(String payload) {
Assert.notNull(payload, "Payload must not be null");
Assert.notNull(payload, "'payload' must not be null");
this.type = Type.TEXT;
this.payload = payload.getBytes();
}
Frame(Type type) {
Assert.notNull(type, "Type must not be null");
Assert.notNull(type, "'type' must not be null");
this.type = type;
this.payload = NO_BYTES;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -76,8 +76,8 @@ public class ClassPathChangeUploader implements ApplicationListener<ClassPathCha
private final ClientHttpRequestFactory requestFactory;
public ClassPathChangeUploader(String url, ClientHttpRequestFactory requestFactory) {
Assert.hasLength(url, "URL must not be empty");
Assert.notNull(requestFactory, "RequestFactory must not be null");
Assert.hasLength(url, "'url' must not be empty");
Assert.notNull(requestFactory, "'requestFactory' must not be null");
try {
this.uri = new URL(url).toURI();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2025 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.
@@ -61,9 +61,9 @@ class DelayedLiveReloadTrigger implements Runnable {
DelayedLiveReloadTrigger(OptionalLiveReloadServer liveReloadServer, ClientHttpRequestFactory requestFactory,
String url) {
Assert.notNull(liveReloadServer, "LiveReloadServer must not be null");
Assert.notNull(requestFactory, "RequestFactory must not be null");
Assert.hasLength(url, "URL must not be empty");
Assert.notNull(liveReloadServer, "'liveReloadServer' must not be null");
Assert.notNull(requestFactory, "'requestFactory' must not be null");
Assert.hasLength(url, "'url' must not be empty");
this.liveReloadServer = liveReloadServer;
this.requestFactory = requestFactory;
try {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2025 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.
@@ -44,8 +44,8 @@ public class HttpHeaderInterceptor implements ClientHttpRequestInterceptor {
* @param value the header value to populate. Cannot be null or empty.
*/
public HttpHeaderInterceptor(String name, String value) {
Assert.hasLength(name, "Name must not be empty");
Assert.hasLength(value, "Value must not be empty");
Assert.hasLength(name, "'name' must not be empty");
Assert.hasLength(value, "'value' must not be empty");
this.name = name;
this.value = value;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2025 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.
@@ -43,8 +43,8 @@ public class Dispatcher {
private final List<HandlerMapper> mappers;
public Dispatcher(AccessManager accessManager, Collection<HandlerMapper> mappers) {
Assert.notNull(accessManager, "AccessManager must not be null");
Assert.notNull(mappers, "Mappers must not be null");
Assert.notNull(accessManager, "'accessManager' must not be null");
Assert.notNull(mappers, "'mappers' must not be null");
this.accessManager = accessManager;
this.mappers = new ArrayList<>(mappers);
AnnotationAwareOrderComparator.sort(this.mappers);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2025 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.
@@ -45,7 +45,7 @@ public class DispatcherFilter implements Filter {
private final Dispatcher dispatcher;
public DispatcherFilter(Dispatcher dispatcher) {
Assert.notNull(dispatcher, "Dispatcher must not be null");
Assert.notNull(dispatcher, "'dispatcher' must not be null");
this.dispatcher = dispatcher;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2025 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.
@@ -33,8 +33,8 @@ public class HttpHeaderAccessManager implements AccessManager {
private final String expectedSecret;
public HttpHeaderAccessManager(String headerName, String expectedSecret) {
Assert.hasLength(headerName, "HeaderName must not be empty");
Assert.hasLength(expectedSecret, "ExpectedSecret must not be empty");
Assert.hasLength(headerName, "'headerName' must not be empty");
Assert.hasLength(expectedSecret, "'expectedSecret' must not be empty");
this.headerName = headerName;
this.expectedSecret = expectedSecret;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2025 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.
@@ -38,8 +38,8 @@ public class UrlHandlerMapper implements HandlerMapper {
* @param handler the handler to use
*/
public UrlHandlerMapper(String url, Handler handler) {
Assert.hasLength(url, "URL must not be empty");
Assert.isTrue(url.startsWith("/"), "URL must start with '/'");
Assert.hasLength(url, "'url' must not be empty");
Assert.isTrue(url.startsWith("/"), "'url' must start with '/'");
this.requestUri = url;
this.handler = handler;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 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.
@@ -35,7 +35,7 @@ class MainMethod {
}
MainMethod(Thread thread) {
Assert.notNull(thread, "Thread must not be null");
Assert.notNull(thread, "'thread' must not be null");
this.method = getMainMethod(thread);
}

View File

@@ -129,9 +129,9 @@ public class Restarter {
* @see #initialize(String[])
*/
protected Restarter(Thread thread, String[] args, boolean forceReferenceCleanup, RestartInitializer initializer) {
Assert.notNull(thread, "Thread must not be null");
Assert.notNull(args, "Args must not be null");
Assert.notNull(initializer, "Initializer must not be null");
Assert.notNull(thread, "'thread' must not be null");
Assert.notNull(args, "'args' must not be null");
Assert.notNull(initializer, "'initializer' must not be null");
if (this.logger.isDebugEnabled()) {
this.logger.debug("Creating new Restarter for thread " + thread);
}
@@ -208,7 +208,7 @@ public class Restarter {
* @param urls the urls to add
*/
public void addUrls(Collection<URL> urls) {
Assert.notNull(urls, "Urls must not be null");
Assert.notNull(urls, "'urls' must not be null");
this.urls.addAll(urls);
}
@@ -217,7 +217,7 @@ public class Restarter {
* @param classLoaderFiles the files to add
*/
public void addClassLoaderFiles(ClassLoaderFiles classLoaderFiles) {
Assert.notNull(classLoaderFiles, "ClassLoaderFiles must not be null");
Assert.notNull(classLoaderFiles, "'classLoaderFiles' must not be null");
this.classLoaderFiles.addAll(classLoaderFiles);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 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.
@@ -54,12 +54,12 @@ public class ClassLoaderFile implements Serializable {
* @param contents the file 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");
if (kind == Kind.DELETED) {
Assert.isTrue(contents == null, "Contents must be null");
Assert.isTrue(contents == null, "'contents' must be null");
}
else {
Assert.isTrue(contents != null, "Contents must not be null");
Assert.isTrue(contents != null, "'contents' must not be null");
}
this.kind = kind;
this.lastModified = lastModified;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -55,7 +55,7 @@ public class ClassLoaderFiles implements ClassLoaderFileRepository, Serializable
* @param classLoaderFiles the source classloader files.
*/
public ClassLoaderFiles(ClassLoaderFiles classLoaderFiles) {
Assert.notNull(classLoaderFiles, "ClassLoaderFiles must not be null");
Assert.notNull(classLoaderFiles, "'classLoaderFiles' must not be null");
this.sourceDirectories = new LinkedHashMap<>(classLoaderFiles.sourceDirectories);
}
@@ -65,7 +65,7 @@ public class ClassLoaderFiles implements ClassLoaderFileRepository, Serializable
* @param files the files to add
*/
public void addAll(ClassLoaderFiles files) {
Assert.notNull(files, "Files must not be null");
Assert.notNull(files, "'files' must not be null");
for (SourceDirectory directory : files.getSourceDirectories()) {
for (Map.Entry<String, ClassLoaderFile> entry : directory.getFilesEntrySet()) {
addFile(directory.getName(), entry.getKey(), entry.getValue());
@@ -89,9 +89,9 @@ public class ClassLoaderFiles implements ClassLoaderFileRepository, Serializable
* @param file the file to add
*/
public void addFile(String sourceDirectory, String name, ClassLoaderFile file) {
Assert.notNull(sourceDirectory, "SourceDirectory must not be null");
Assert.notNull(name, "Name must not be null");
Assert.notNull(file, "File must not be null");
Assert.notNull(sourceDirectory, "'sourceDirectory' must not be null");
Assert.notNull(name, "'name' must not be null");
Assert.notNull(file, "'file' must not be null");
removeAll(name);
getOrCreateSourceDirectory(sourceDirectory).add(name, file);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 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.
@@ -57,8 +57,8 @@ public class RestartClassLoader extends URLClassLoader implements SmartClassLoad
*/
public RestartClassLoader(ClassLoader parent, URL[] urls, ClassLoaderFileRepository updatedFiles) {
super(urls, parent);
Assert.notNull(parent, "Parent must not be null");
Assert.notNull(updatedFiles, "UpdatedFiles must not be null");
Assert.notNull(parent, "'parent' must not be null");
Assert.notNull(updatedFiles, "'updatedFiles' must not be null");
this.updatedFiles = updatedFiles;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2025 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.
@@ -48,7 +48,7 @@ public class HttpRestartServer {
* the local classpath
*/
public HttpRestartServer(SourceDirectoryUrlFilter sourceDirectoryUrlFilter) {
Assert.notNull(sourceDirectoryUrlFilter, "SourceDirectoryUrlFilter must not be null");
Assert.notNull(sourceDirectoryUrlFilter, "'sourceDirectoryUrlFilter' must not be null");
this.server = new RestartServer(sourceDirectoryUrlFilter);
}
@@ -57,7 +57,7 @@ public class HttpRestartServer {
* @param restartServer the underlying restart server
*/
public HttpRestartServer(RestartServer restartServer) {
Assert.notNull(restartServer, "RestartServer must not be null");
Assert.notNull(restartServer, "'restartServer' must not be null");
this.server = restartServer;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2025 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.
@@ -38,7 +38,7 @@ public class HttpRestartServerHandler implements Handler {
* @param server the server to adapt
*/
public HttpRestartServerHandler(HttpRestartServer server) {
Assert.notNull(server, "Server must not be null");
Assert.notNull(server, "'server' must not be null");
this.server = server;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2025 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.
@@ -68,8 +68,8 @@ public class RestartServer {
* @param classLoader the application classloader
*/
public RestartServer(SourceDirectoryUrlFilter sourceDirectoryUrlFilter, ClassLoader classLoader) {
Assert.notNull(sourceDirectoryUrlFilter, "SourceDirectoryUrlFilter must not be null");
Assert.notNull(classLoader, "ClassLoader must not be null");
Assert.notNull(sourceDirectoryUrlFilter, "'sourceDirectoryUrlFilter' must not be null");
Assert.notNull(classLoader, "'classLoader' must not be null");
this.sourceDirectoryUrlFilter = sourceDirectoryUrlFilter;
this.classLoader = classLoader;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -37,7 +37,7 @@ class TriggerFileFilterTests {
@Test
void nameMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new TriggerFileFilter(null))
.withMessageContaining("Name must not be null");
.withMessageContaining("'name' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -38,7 +38,7 @@ class ClassPathChangedEventTests {
@Test
void changeSetMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new ClassPathChangedEvent(this.source, null, false))
.withMessageContaining("ChangeSet must not be null");
.withMessageContaining("'changeSet' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -59,14 +59,14 @@ class ClassPathFileChangeListenerTests {
void eventPublisherMustNotBeNull() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new ClassPathFileChangeListener(null, this.restartStrategy, this.fileSystemWatcher))
.withMessageContaining("EventPublisher must not be null");
.withMessageContaining("'eventPublisher' must not be null");
}
@Test
void restartStrategyMustNotBeNull() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new ClassPathFileChangeListener(this.eventPublisher, null, this.fileSystemWatcher))
.withMessageContaining("RestartStrategy must not be null");
.withMessageContaining("'restartStrategy' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -55,7 +55,7 @@ class ClassPathFileSystemWatcherTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> new ClassPathFileSystemWatcher(mock(FileSystemWatcherFactory.class),
mock(ClassPathRestartStrategy.class), (URL[]) null))
.withMessageContaining("Urls must not be null");
.withMessageContaining("'urls' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -40,14 +40,14 @@ class ChangedFileTests {
void sourceDirectoryMustNotBeNull() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new ChangedFile(null, new File(this.tempDir, "file"), Type.ADD))
.withMessageContaining("SourceDirectory must not be null");
.withMessageContaining("'sourceDirectory' must not be null");
}
@Test
void fileMustNotBeNull() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new ChangedFile(new File(this.tempDir, "directory"), null, Type.ADD))
.withMessageContaining("File must not be null");
.withMessageContaining("'file' must not be null");
}
@Test
@@ -55,7 +55,7 @@ class ChangedFileTests {
assertThatIllegalArgumentException()
.isThrownBy(
() -> new ChangedFile(new File(this.tempDir, "file"), new File(this.tempDir, "directory"), null))
.withMessageContaining("Type must not be null");
.withMessageContaining("'type' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -53,7 +53,7 @@ class DirectorySnapshotTests {
@Test
void directoryMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new DirectorySnapshot(null))
.withMessageContaining("Directory must not be null");
.withMessageContaining("'directory' must not be null");
}
@Test
@@ -61,7 +61,7 @@ class DirectorySnapshotTests {
File file = new File(this.tempDir, "file");
file.createNewFile();
assertThatIllegalArgumentException().isThrownBy(() -> new DirectorySnapshot(file))
.withMessageContaining("Directory '" + file + "' must not be a file");
.withMessageContaining("'directory' [" + file + "] must not be a file");
}
@Test
@@ -103,14 +103,14 @@ class DirectorySnapshotTests {
@Test
void getChangedFilesSnapshotMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> this.initialSnapshot.getChangedFiles(null, null))
.withMessageContaining("Snapshot must not be null");
.withMessageContaining("'snapshot' must not be null");
}
@Test
void getChangedFilesSnapshotMustBeTheSameSourceDirectory() {
assertThatIllegalArgumentException().isThrownBy(
() -> this.initialSnapshot.getChangedFiles(new DirectorySnapshot(createTestDirectoryStructure()), null))
.withMessageContaining("Snapshot source directory must be '" + this.directory + "'");
.withMessageContaining("'snapshot' source directory must be '" + this.directory + "'");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -47,7 +47,7 @@ class FileSnapshotTests {
@Test
void fileMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new FileSnapshot(null))
.withMessageContaining("File must not be null");
.withMessageContaining("'file' must not be null");
}
@Test
@@ -55,7 +55,7 @@ class FileSnapshotTests {
File file = new File(this.tempDir, "file");
file.mkdir();
assertThatIllegalArgumentException().isThrownBy(() -> new FileSnapshot(file))
.withMessageContaining("File must not be a directory");
.withMessageContaining("'file' [" + file + "] must be a normal file");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 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.
@@ -64,27 +64,27 @@ class FileSystemWatcherTests {
void pollIntervalMustBePositive() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new FileSystemWatcher(true, Duration.ofMillis(0), Duration.ofMillis(1)))
.withMessageContaining("PollInterval must be positive");
.withMessageContaining("'pollInterval' must be positive");
}
@Test
void quietPeriodMustBePositive() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new FileSystemWatcher(true, Duration.ofMillis(1), Duration.ofMillis(0)))
.withMessageContaining("QuietPeriod must be positive");
.withMessageContaining("'quietPeriod' must be positive");
}
@Test
void pollIntervalMustBeGreaterThanQuietPeriod() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new FileSystemWatcher(true, Duration.ofMillis(1), Duration.ofMillis(1)))
.withMessageContaining("PollInterval must be greater than QuietPeriod");
.withMessageContaining("'pollInterval' must be greater than QuietPeriod");
}
@Test
void listenerMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> this.watcher.addListener(null))
.withMessageContaining("FileChangeListener must not be null");
.withMessageContaining("'fileChangeListener' must not be null");
}
@Test
@@ -97,7 +97,7 @@ class FileSystemWatcherTests {
@Test
void sourceDirectoryMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> this.watcher.addSourceDirectory(null))
.withMessageContaining("Directory must not be null");
.withMessageContaining("'directory' must not be null");
}
@Test
@@ -106,7 +106,7 @@ class FileSystemWatcherTests {
assertThat(file.createNewFile()).isTrue();
assertThat(file).isFile();
assertThatIllegalArgumentException().isThrownBy(() -> this.watcher.addSourceDirectory(file))
.withMessageContaining("Directory '" + file + "' must not be a file");
.withMessageContaining("'directory' [" + file + "] must not be a file");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -36,13 +36,13 @@ class FrameTests {
@Test
void payloadMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new Frame((String) null))
.withMessageContaining("Payload must not be null");
.withMessageContaining("'payload' must not be null");
}
@Test
void typeMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new Frame((Frame.Type) null))
.withMessageContaining("Type must not be null");
.withMessageContaining("'type' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -67,20 +67,20 @@ class ClassPathChangeUploaderTests {
@Test
void urlMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new ClassPathChangeUploader(null, this.requestFactory))
.withMessageContaining("URL must not be empty");
.withMessageContaining("'url' must not be empty");
}
@Test
void urlMustNotBeEmpty() {
assertThatIllegalArgumentException().isThrownBy(() -> new ClassPathChangeUploader("", this.requestFactory))
.withMessageContaining("URL must not be empty");
.withMessageContaining("'url' must not be empty");
}
@Test
void requestFactoryMustNotBeNull() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new ClassPathChangeUploader("http://localhost:8080", null))
.withMessageContaining("RequestFactory must not be null");
.withMessageContaining("'requestFactory' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -77,28 +77,28 @@ class DelayedLiveReloadTriggerTests {
void liveReloadServerMustNotBeNull() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new DelayedLiveReloadTrigger(null, this.requestFactory, URL))
.withMessageContaining("LiveReloadServer must not be null");
.withMessageContaining("'liveReloadServer' must not be null");
}
@Test
void requestFactoryMustNotBeNull() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new DelayedLiveReloadTrigger(this.liveReloadServer, null, URL))
.withMessageContaining("RequestFactory must not be null");
.withMessageContaining("'requestFactory' must not be null");
}
@Test
void urlMustNotBeNull() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new DelayedLiveReloadTrigger(this.liveReloadServer, this.requestFactory, null))
.withMessageContaining("URL must not be empty");
.withMessageContaining("'url' must not be empty");
}
@Test
void urlMustNotBeEmpty() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new DelayedLiveReloadTrigger(this.liveReloadServer, this.requestFactory, ""))
.withMessageContaining("URL must not be empty");
.withMessageContaining("'url' must not be empty");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -74,25 +74,25 @@ class HttpHeaderInterceptorTests {
@Test
void constructorNullHeaderName() {
assertThatIllegalArgumentException().isThrownBy(() -> new HttpHeaderInterceptor(null, this.value))
.withMessageContaining("Name must not be empty");
.withMessageContaining("'name' must not be empty");
}
@Test
void constructorEmptyHeaderName() {
assertThatIllegalArgumentException().isThrownBy(() -> new HttpHeaderInterceptor("", this.value))
.withMessageContaining("Name must not be empty");
.withMessageContaining("'name' must not be empty");
}
@Test
void constructorNullHeaderValue() {
assertThatIllegalArgumentException().isThrownBy(() -> new HttpHeaderInterceptor(this.name, null))
.withMessageContaining("Value must not be empty");
.withMessageContaining("'value' must not be empty");
}
@Test
void constructorEmptyHeaderValue() {
assertThatIllegalArgumentException().isThrownBy(() -> new HttpHeaderInterceptor(this.name, ""))
.withMessageContaining("Value must not be empty");
.withMessageContaining("'value' must not be empty");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -66,7 +66,7 @@ class DispatcherFilterTests {
@Test
void dispatcherMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new DispatcherFilter(null))
.withMessageContaining("Dispatcher must not be null");
.withMessageContaining("'dispatcher' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -63,13 +63,13 @@ class DispatcherTests {
@Test
void accessManagerMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new Dispatcher(null, Collections.emptyList()))
.withMessageContaining("AccessManager must not be null");
.withMessageContaining("'accessManager' must not be null");
}
@Test
void mappersMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new Dispatcher(this.accessManager, null))
.withMessageContaining("Mappers must not be null");
.withMessageContaining("'mappers' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -54,25 +54,25 @@ class HttpHeaderAccessManagerTests {
@Test
void headerNameMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new HttpHeaderAccessManager(null, SECRET))
.withMessageContaining("HeaderName must not be empty");
.withMessageContaining("'headerName' must not be empty");
}
@Test
void headerNameMustNotBeEmpty() {
assertThatIllegalArgumentException().isThrownBy(() -> new HttpHeaderAccessManager("", SECRET))
.withMessageContaining("HeaderName must not be empty");
.withMessageContaining("'headerName' must not be empty");
}
@Test
void expectedSecretMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new HttpHeaderAccessManager(HEADER, null))
.withMessageContaining("ExpectedSecret must not be empty");
.withMessageContaining("'expectedSecret' must not be empty");
}
@Test
void expectedSecretMustNotBeEmpty() {
assertThatIllegalArgumentException().isThrownBy(() -> new HttpHeaderAccessManager(HEADER, ""))
.withMessageContaining("ExpectedSecret must not be empty");
.withMessageContaining("'expectedSecret' must not be empty");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -40,19 +40,19 @@ class UrlHandlerMapperTests {
@Test
void requestUriMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new UrlHandlerMapper(null, this.handler))
.withMessageContaining("URL must not be empty");
.withMessageContaining("'url' must not be empty");
}
@Test
void requestUriMustNotBeEmpty() {
assertThatIllegalArgumentException().isThrownBy(() -> new UrlHandlerMapper("", this.handler))
.withMessageContaining("URL must not be empty");
.withMessageContaining("'url' must not be empty");
}
@Test
void requestUrlMustStartWithSlash() {
assertThatIllegalArgumentException().isThrownBy(() -> new UrlHandlerMapper("tunnel", this.handler))
.withMessageContaining("URL must start with '/'");
.withMessageContaining("'url' must start with '/'");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 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.
@@ -47,7 +47,7 @@ class MainMethodTests {
@Test
void threadMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new MainMethod(null))
.withMessageContaining("Thread must not be null");
.withMessageContaining("'thread' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 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.
@@ -113,7 +113,7 @@ class RestarterTests {
@Test
void addUrlsMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> Restarter.getInstance().addUrls(null))
.withMessageContaining("Urls must not be null");
.withMessageContaining("'urls' must not be null");
}
@Test
@@ -130,7 +130,7 @@ class RestarterTests {
@Test
void addClassLoaderFilesMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> Restarter.getInstance().addClassLoaderFiles(null))
.withMessageContaining("ClassLoaderFiles must not be null");
.withMessageContaining("'classLoaderFiles' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -35,25 +35,25 @@ class ClassLoaderFileTests {
@Test
void kindMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new ClassLoaderFile(null, null))
.withMessageContaining("Kind must not be null");
.withMessageContaining("'kind' must not be null");
}
@Test
void addedContentsMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new ClassLoaderFile(Kind.ADDED, null))
.withMessageContaining("Contents must not be null");
.withMessageContaining("'contents' must not be null");
}
@Test
void modifiedContentsMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new ClassLoaderFile(Kind.MODIFIED, null))
.withMessageContaining("Contents must not be null");
.withMessageContaining("'contents' must not be null");
}
@Test
void deletedContentsMustBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new ClassLoaderFile(Kind.DELETED, new byte[10]))
.withMessageContaining("Contents must be null");
.withMessageContaining("'contents' must be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -43,13 +43,13 @@ class ClassLoaderFilesTests {
@Test
void addFileNameMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> this.files.addFile(null, mock(ClassLoaderFile.class)))
.withMessageContaining("Name must not be null");
.withMessageContaining("'name' must not be null");
}
@Test
void addFileFileMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> this.files.addFile("test", null))
.withMessageContaining("File must not be null");
.withMessageContaining("'file' must not be null");
}
@Test
@@ -153,7 +153,7 @@ class ClassLoaderFilesTests {
@Test
void classLoaderFilesMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new ClassLoaderFiles(null))
.withMessageContaining("ClassLoaderFiles must not be null");
.withMessageContaining("'classLoaderFiles' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -104,14 +104,14 @@ class RestartClassLoaderTests {
@Test
void parentMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new RestartClassLoader(null, new URL[] {}))
.withMessageContaining("Parent must not be null");
.withMessageContaining("'parent' must not be null");
}
@Test
void updatedFilesMustNotBeNull() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new RestartClassLoader(this.parentClassLoader, new URL[] {}, null))
.withMessageContaining("UpdatedFiles must not be null");
.withMessageContaining("'updatedFiles' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -35,7 +35,7 @@ class HttpRestartServerHandlerTests {
@Test
void serverMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new HttpRestartServerHandler(null))
.withMessageContaining("Server must not be null");
.withMessageContaining("'server' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -60,13 +60,13 @@ class HttpRestartServerTests {
@Test
void sourceDirectoryUrlFilterMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new HttpRestartServer((SourceDirectoryUrlFilter) null))
.withMessageContaining("SourceDirectoryUrlFilter must not be null");
.withMessageContaining("'sourceDirectoryUrlFilter' must not be null");
}
@Test
void restartServerMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new HttpRestartServer((RestartServer) null))
.withMessageContaining("RestartServer must not be null");
.withMessageContaining("'restartServer' must not be null");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
@@ -45,7 +45,7 @@ class RestartServerTests {
@Test
void sourceDirectoryUrlFilterMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new RestartServer((SourceDirectoryUrlFilter) null))
.withMessageContaining("SourceDirectoryUrlFilter must not be null");
.withMessageContaining("'sourceDirectoryUrlFilter' must not be null");
}
@Test