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-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.
@@ -53,7 +53,7 @@ class AutoConfigurationSorter {
AutoConfigurationSorter(MetadataReaderFactory metadataReaderFactory,
AutoConfigurationMetadata autoConfigurationMetadata, UnaryOperator<String> replacementMapper) {
Assert.notNull(metadataReaderFactory, "MetadataReaderFactory must not be null");
Assert.notNull(metadataReaderFactory, "'metadataReaderFactory' must not be null");
this.metadataReaderFactory = metadataReaderFactory;
this.autoConfigurationMetadata = autoConfigurationMetadata;
this.replacementMapper = replacementMapper;

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.
@@ -61,8 +61,8 @@ public abstract class AbstractConnectionFactoryConfigurer<T extends AbstractConn
*/
protected AbstractConnectionFactoryConfigurer(RabbitProperties properties,
RabbitConnectionDetails connectionDetails) {
Assert.notNull(properties, "Properties must not be null");
Assert.notNull(connectionDetails, "ConnectionDetails must not be null");
Assert.notNull(properties, "'properties' must not be null");
Assert.notNull(connectionDetails, "'connectionDetails' must not be null");
this.rabbitProperties = properties;
this.connectionDetails = connectionDetails;
}
@@ -80,7 +80,7 @@ public abstract class AbstractConnectionFactoryConfigurer<T extends AbstractConn
* @param connectionFactory connection factory to configure
*/
public final void configure(T connectionFactory) {
Assert.notNull(connectionFactory, "ConnectionFactory must not be null");
Assert.notNull(connectionFactory, "'connectionFactory' must not be null");
PropertyMapper map = PropertyMapper.get();
String addresses = this.connectionDetails.getAddresses()
.stream()

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.
@@ -108,9 +108,9 @@ public abstract class AbstractRabbitListenerContainerFactoryConfigurer<T extends
protected void configure(T factory, ConnectionFactory connectionFactory,
RabbitProperties.AmqpContainer configuration) {
Assert.notNull(factory, "Factory must not be null");
Assert.notNull(connectionFactory, "ConnectionFactory must not be null");
Assert.notNull(configuration, "Configuration must not be null");
Assert.notNull(factory, "'factory' must not be null");
Assert.notNull(connectionFactory, "'connectionFactory' must not be null");
Assert.notNull(configuration, "'configuration' must not be null");
factory.setConnectionFactory(connectionFactory);
if (this.messageConverter != null) {
factory.setMessageConverter(this.messageConverter);

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.
@@ -90,9 +90,9 @@ public class RabbitConnectionFactoryBeanConfigurer {
*/
public RabbitConnectionFactoryBeanConfigurer(ResourceLoader resourceLoader, RabbitProperties properties,
RabbitConnectionDetails connectionDetails, SslBundles sslBundles) {
Assert.notNull(resourceLoader, "ResourceLoader must not be null");
Assert.notNull(properties, "Properties must not be null");
Assert.notNull(connectionDetails, "ConnectionDetails must not be null");
Assert.notNull(resourceLoader, "'resourceLoader' must not be null");
Assert.notNull(properties, "'properties' must not be null");
Assert.notNull(connectionDetails, "'connectionDetails' must not be null");
this.resourceLoader = resourceLoader;
this.rabbitProperties = properties;
this.connectionDetails = connectionDetails;
@@ -115,7 +115,7 @@ public class RabbitConnectionFactoryBeanConfigurer {
* @param factory the {@link RabbitConnectionFactoryBean} instance to configure
*/
public void configure(RabbitConnectionFactoryBean factory) {
Assert.notNull(factory, "RabbitConnectionFactoryBean must not be null");
Assert.notNull(factory, "'factory' must not be null");
factory.setResourceLoader(this.resourceLoader);
Address address = this.connectionDetails.getFirstAddress();
PropertyMapper map = PropertyMapper.get();

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.
@@ -49,7 +49,7 @@ public class RabbitTemplateConfigurer {
* @since 2.6.0
*/
public RabbitTemplateConfigurer(RabbitProperties rabbitProperties) {
Assert.notNull(rabbitProperties, "RabbitProperties must not be null");
Assert.notNull(rabbitProperties, "'rabbitProperties' must not be null");
this.rabbitProperties = rabbitProperties;
}

View File

@@ -102,9 +102,9 @@ public class JobLauncherApplicationRunner
* when running a job
*/
public JobLauncherApplicationRunner(JobLauncher jobLauncher, JobExplorer jobExplorer, JobRepository jobRepository) {
Assert.notNull(jobLauncher, "JobLauncher must not be null");
Assert.notNull(jobExplorer, "JobExplorer must not be null");
Assert.notNull(jobRepository, "JobRepository must not be null");
Assert.notNull(jobLauncher, "'jobLauncher' must not be null");
Assert.notNull(jobExplorer, "'jobExplorer' must not be null");
Assert.notNull(jobRepository, "'jobRepository' must not be null");
this.jobLauncher = jobLauncher;
this.jobExplorer = jobExplorer;
this.jobRepository = jobRepository;

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.
@@ -102,7 +102,7 @@ public class CacheProperties {
public Resource resolveConfigLocation(Resource config) {
if (config != null) {
Assert.isTrue(config.exists(),
() -> "Cache configuration does not exist '" + config.getDescription() + "'");
() -> "'config' resource [%s] must exist".formatted(config.getDescription()));
return config;
}
return null;

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 @@ public abstract class AbstractNestedCondition extends SpringBootCondition implem
private final ConfigurationPhase configurationPhase;
AbstractNestedCondition(ConfigurationPhase configurationPhase) {
Assert.notNull(configurationPhase, "ConfigurationPhase must not be null");
Assert.notNull(configurationPhase, "'configurationPhase' must not be null");
this.configurationPhase = configurationPhase;
}

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.
@@ -76,9 +76,9 @@ public final class ConditionEvaluationReport {
* @param outcome the condition outcome
*/
public void recordConditionEvaluation(String source, Condition condition, ConditionOutcome outcome) {
Assert.notNull(source, "Source must not be null");
Assert.notNull(condition, "Condition must not be null");
Assert.notNull(outcome, "Outcome must not be null");
Assert.notNull(source, "'source' must not be null");
Assert.notNull(condition, "'condition' must not be null");
Assert.notNull(outcome, "'outcome' must not be null");
this.unconditionalClasses.remove(source);
this.outcomes.computeIfAbsent(source, (key) -> new ConditionAndOutcomes()).add(condition, outcome);
this.addedAncestorOutcomes = false;
@@ -89,7 +89,7 @@ public final class ConditionEvaluationReport {
* @param exclusions the names of the excluded classes
*/
public void recordExclusions(Collection<String> exclusions) {
Assert.notNull(exclusions, "exclusions must not be null");
Assert.notNull(exclusions, "'exclusions' must not be null");
this.exclusions.addAll(exclusions);
}
@@ -99,7 +99,7 @@ public final class ConditionEvaluationReport {
* evaluated
*/
public void recordEvaluationCandidates(List<String> evaluationCandidates) {
Assert.notNull(evaluationCandidates, "evaluationCandidates must not be null");
Assert.notNull(evaluationCandidates, "'evaluationCandidates' must not be null");
this.unconditionalClasses.addAll(evaluationCandidates);
}

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.
@@ -108,7 +108,7 @@ public final class ConditionMessage {
* @see #forCondition(Class, Object...)
*/
public Builder andCondition(Class<? extends Annotation> condition, Object... details) {
Assert.notNull(condition, "Condition must not be null");
Assert.notNull(condition, "'condition' must not be null");
return andCondition("@" + ClassUtils.getShortName(condition), details);
}
@@ -122,7 +122,7 @@ public final class ConditionMessage {
* @see #forCondition(String, Object...)
*/
public Builder andCondition(String condition, Object... details) {
Assert.notNull(condition, "Condition must not be null");
Assert.notNull(condition, "'condition' must not be null");
String detail = StringUtils.arrayToDelimitedString(details, " ");
if (StringUtils.hasLength(detail)) {
return new Builder(condition + " " + detail);
@@ -379,7 +379,7 @@ public final class ConditionMessage {
* @return a built {@link ConditionMessage}
*/
public ConditionMessage items(Style style, Collection<?> items) {
Assert.notNull(style, "Style must not be null");
Assert.notNull(style, "'style' must not be null");
StringBuilder message = new StringBuilder(this.reason);
items = style.applyTo(items);
if ((this.condition == null || items == null || items.size() <= 1)

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.
@@ -48,7 +48,7 @@ public class ConditionOutcome {
* @param message the condition message
*/
public ConditionOutcome(boolean match, ConditionMessage message) {
Assert.notNull(message, "ConditionMessage must not be null");
Assert.notNull(message, "'message' must not be null");
this.match = match;
this.message = message;
}

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.
@@ -77,8 +77,8 @@ class MongoDatabaseFactoryDependentConfiguration {
GridFsMongoDatabaseFactory(MongoDatabaseFactory mongoDatabaseFactory,
MongoConnectionDetails connectionDetails) {
Assert.notNull(mongoDatabaseFactory, "MongoDatabaseFactory must not be null");
Assert.notNull(connectionDetails, "ConnectionDetails must not be null");
Assert.notNull(mongoDatabaseFactory, "'mongoDatabaseFactory' must not be null");
Assert.notNull(connectionDetails, "'connectionDetails' must not be null");
this.mongoDatabaseFactory = mongoDatabaseFactory;
this.connectionDetails = connectionDetails;
}

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.
@@ -103,7 +103,7 @@ public interface RedisConnectionDetails extends ConnectionDetails {
}
static Standalone of(String host, int port, int database) {
Assert.hasLength(host, "Host must not be empty");
Assert.hasLength(host, "'host' must not be empty");
return new Standalone() {
@Override

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.
@@ -65,7 +65,8 @@ class NoSuchBeanDefinitionFailureAnalyzer extends AbstractInjectionFailureAnalyz
private final ConditionEvaluationReport report;
NoSuchBeanDefinitionFailureAnalyzer(BeanFactory beanFactory) {
Assert.isInstanceOf(ConfigurableListableBeanFactory.class, beanFactory);
Assert.isTrue(beanFactory instanceof ConfigurableListableBeanFactory,
"'beanFactory' must be a ConfigurableListableBeanFactory");
this.beanFactory = (ConfigurableListableBeanFactory) beanFactory;
this.metadataReaderFactory = new CachingMetadataReaderFactory(this.beanFactory.getBeanClassLoader());
// Get early as won't be accessible once context has failed to start

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.
@@ -96,8 +96,8 @@ public class EntityScanPackages {
* @param packageNames the package names to register
*/
public static void register(BeanDefinitionRegistry registry, String... packageNames) {
Assert.notNull(registry, "Registry must not be null");
Assert.notNull(packageNames, "PackageNames must not be null");
Assert.notNull(registry, "'registry' must not be null");
Assert.notNull(packageNames, "'packageNames' must not be null");
register(registry, Arrays.asList(packageNames));
}
@@ -107,8 +107,8 @@ public class EntityScanPackages {
* @param packageNames the package names to register
*/
public static void register(BeanDefinitionRegistry registry, Collection<String> packageNames) {
Assert.notNull(registry, "Registry must not be null");
Assert.notNull(packageNames, "PackageNames must not be null");
Assert.notNull(registry, "'registry' must not be null");
Assert.notNull(packageNames, "'packageNames' must not be null");
if (registry.containsBeanDefinition(BEAN)) {
EntityScanPackagesBeanDefinition beanDefinition = (EntityScanPackagesBeanDefinition) registry
.getBeanDefinition(BEAN);

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.
@@ -47,7 +47,7 @@ public class EntityScanner {
* @param context the source application context
*/
public EntityScanner(ApplicationContext context) {
Assert.notNull(context, "Context must not be null");
Assert.notNull(context, "'context' must not be null");
this.context = context;
}

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.
@@ -51,7 +51,7 @@ public class FlywayMigrationInitializer implements InitializingBean, Ordered {
* @param migrationStrategy the migration strategy or {@code null}
*/
public FlywayMigrationInitializer(Flyway flyway, FlywayMigrationStrategy migrationStrategy) {
Assert.notNull(flyway, "Flyway must not be null");
Assert.notNull(flyway, "'flyway' must not be null");
this.flyway = flyway;
this.migrationStrategy = migrationStrategy;
}

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.
@@ -47,9 +47,9 @@ public class H2ConsoleProperties {
}
public void setPath(String path) {
Assert.notNull(path, "Path must not be null");
Assert.isTrue(path.length() > 1, "Path must have length greater than 1");
Assert.isTrue(path.startsWith("/"), "Path must start with '/'");
Assert.notNull(path, "'path' must not be null");
Assert.isTrue(path.length() > 1, "'path' must have length greater than 1");
Assert.isTrue(path.startsWith("/"), "'path' must start with '/'");
this.path = path;
}

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.
@@ -41,7 +41,7 @@ public abstract class HazelcastConfigResourceCondition extends ResourceCondition
protected HazelcastConfigResourceCondition(String configSystemProperty, String... resourceLocations) {
super("Hazelcast", HAZELCAST_CONFIG_PROPERTY, resourceLocations);
Assert.notNull(configSystemProperty, "ConfigSystemProperty must not be null");
Assert.notNull(configSystemProperty, "'configSystemProperty' must not be null");
this.configSystemProperty = configSystemProperty;
}

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,8 +113,8 @@ public final class DefaultJmsListenerContainerFactoryConfigurer {
* @param connectionFactory the {@link ConnectionFactory} to use
*/
public void configure(DefaultJmsListenerContainerFactory factory, ConnectionFactory connectionFactory) {
Assert.notNull(factory, "Factory must not be null");
Assert.notNull(connectionFactory, "ConnectionFactory must not be null");
Assert.notNull(factory, "'factory' must not be null");
Assert.notNull(connectionFactory, "'connectionFactory' must not be null");
JmsProperties.Listener listenerProperties = this.jmsProperties.getListener();
Session sessionProperties = listenerProperties.getSession();
factory.setConnectionFactory(connectionFactory);

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.
@@ -41,7 +41,7 @@ class ActiveMQConnectionFactoryConfigurer {
ActiveMQConnectionFactoryConfigurer(ActiveMQProperties properties,
List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
Assert.notNull(properties, "Properties must not be null");
Assert.notNull(properties, "'properties' must not be null");
this.properties = properties;
this.factoryCustomizers = (factoryCustomizers != null) ? factoryCustomizers : Collections.emptyList();
}

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.
@@ -53,9 +53,9 @@ class ArtemisConnectionFactoryFactory {
ArtemisConnectionFactoryFactory(ListableBeanFactory beanFactory, ArtemisProperties properties,
ArtemisConnectionDetails connectionDetails) {
Assert.notNull(beanFactory, "BeanFactory must not be null");
Assert.notNull(properties, "Properties must not be null");
Assert.notNull(connectionDetails, "ConnectionDetails must not be null");
Assert.notNull(beanFactory, "'beanFactory' must not be null");
Assert.notNull(properties, "'properties' must not be null");
Assert.notNull(connectionDetails, "'connectionDetails' must not be null");
this.beanFactory = beanFactory;
this.properties = properties;
this.connectionDetails = connectionDetails;

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.
@@ -63,7 +63,7 @@ final class DefaultExceptionTranslatorExecuteListener implements ExceptionTransl
private DefaultExceptionTranslatorExecuteListener(Log logger,
Function<ExecuteContext, SQLExceptionTranslator> translatorFactory) {
Assert.notNull(translatorFactory, "TranslatorFactory must not be null");
Assert.notNull(translatorFactory, "'translatorFactory' must not be null");
this.logger = logger;
this.translatorFactory = translatorFactory;
}

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.
@@ -125,7 +125,7 @@ public class LdapProperties {
}
private int determinePort(Environment environment) {
Assert.notNull(environment, "Environment must not be null");
Assert.notNull(environment, "'environment' must not be null");
String localPort = environment.getProperty("local.ldap.port");
if (localPort != null) {
return Integer.parseInt(localPort);

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.
@@ -159,7 +159,7 @@ public class LiquibaseProperties {
}
public void setChangeLog(String changeLog) {
Assert.notNull(changeLog, "ChangeLog must not be null");
Assert.notNull(changeLog, "'changeLog' must not be null");
this.changeLog = changeLog;
}

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 ConditionEvaluationReportLogger {
private final LogLevel logLevel;
ConditionEvaluationReportLogger(LogLevel logLevel, Supplier<ConditionEvaluationReport> reportSupplier) {
Assert.isTrue(isInfoOrDebug(logLevel), "LogLevel must be INFO or DEBUG");
Assert.isTrue(isInfoOrDebug(logLevel), "'logLevel' must be INFO or DEBUG");
this.logLevel = logLevel;
this.reportSupplier = reportSupplier;
}
private boolean isInfoOrDebug(LogLevel logLevelForReport) {
return LogLevel.INFO.equals(logLevelForReport) || LogLevel.DEBUG.equals(logLevelForReport);
private boolean isInfoOrDebug(LogLevel logLevel) {
return LogLevel.INFO.equals(logLevel) || LogLevel.DEBUG.equals(logLevel);
}
void logReport(boolean isCrashReport) {

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,15 +50,15 @@ import org.springframework.util.Assert;
public class ConditionEvaluationReportLoggingListener
implements ApplicationContextInitializer<ConfigurableApplicationContext> {
private final LogLevel logLevelForReport;
private final LogLevel logLevel;
public ConditionEvaluationReportLoggingListener() {
this(LogLevel.DEBUG);
}
private ConditionEvaluationReportLoggingListener(LogLevel logLevelForReport) {
Assert.isTrue(isInfoOrDebug(logLevelForReport), "LogLevel must be INFO or DEBUG");
this.logLevelForReport = logLevelForReport;
private ConditionEvaluationReportLoggingListener(LogLevel logLevel) {
Assert.isTrue(isInfoOrDebug(logLevel), "'logLevel' must be INFO or DEBUG");
this.logLevel = logLevel;
}
private boolean isInfoOrDebug(LogLevel logLevelForReport) {
@@ -100,8 +100,8 @@ public class ConditionEvaluationReportLoggingListener
else {
reportSupplier = this::getReport;
}
this.logger = new ConditionEvaluationReportLogger(
ConditionEvaluationReportLoggingListener.this.logLevelForReport, reportSupplier);
this.logger = new ConditionEvaluationReportLogger(ConditionEvaluationReportLoggingListener.this.logLevel,
reportSupplier);
}
private ConditionEvaluationReport getReport() {

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.
@@ -77,8 +77,8 @@ public class HibernateProperties {
*/
public Map<String, Object> determineHibernateProperties(Map<String, String> jpaProperties,
HibernateSettings settings) {
Assert.notNull(jpaProperties, "JpaProperties must not be null");
Assert.notNull(settings, "Settings must not be null");
Assert.notNull(jpaProperties, "'jpaProperties' must not be null");
Assert.notNull(settings, "'settings' must not be null");
return getAdditionalProperties(jpaProperties, settings);
}

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.
@@ -292,9 +292,9 @@ public class PulsarProperties {
public record TypeMapping(Class<?> messageType, String topicName, SchemaInfo schemaInfo) {
public TypeMapping {
Assert.notNull(messageType, "messageType must not be null");
Assert.notNull(messageType, "'messageType' must not be null");
Assert.isTrue(topicName != null || schemaInfo != null,
"At least one of topicName or schemaInfo must not be null");
"At least one of 'topicName' or 'schemaInfo' must not be null");
}
}
@@ -309,10 +309,10 @@ public class PulsarProperties {
public record SchemaInfo(SchemaType schemaType, Class<?> messageKeyType) {
public SchemaInfo {
Assert.notNull(schemaType, "schemaType must not be null");
Assert.isTrue(schemaType != SchemaType.NONE, "schemaType 'NONE' not supported");
Assert.notNull(schemaType, "'schemaType' must not be null");
Assert.isTrue(schemaType != SchemaType.NONE, "'schemaType' must not be NONE");
Assert.isTrue(messageKeyType == null || schemaType == SchemaType.KEY_VALUE,
"messageKeyType can only be set when schemaType is KEY_VALUE");
"'messageKeyType' can only be set when 'schemaType' is KEY_VALUE");
}
}

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.
@@ -26,7 +26,6 @@ import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.source.InvalidConfigurationPropertyValueException;
import org.springframework.core.io.Resource;
import org.springframework.util.Assert;
import org.springframework.util.StreamUtils;
/**
@@ -175,7 +174,10 @@ public class OAuth2ResourceServerProperties {
public String readPublicKey() throws IOException {
String key = "spring.security.oauth2.resourceserver.public-key-location";
Assert.notNull(this.publicKeyLocation, "PublicKeyLocation must not be null");
if (this.publicKeyLocation == null) {
throw new InvalidConfigurationPropertyValueException(key, this.publicKeyLocation,
"No public key location specified");
}
if (!this.publicKeyLocation.exists()) {
throw new InvalidConfigurationPropertyValueException(key, this.publicKeyLocation,
"Public key location does not exist");

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.
@@ -81,7 +81,7 @@ public final class StaticResourceRequest {
* @return the configured {@link ServerWebExchangeMatcher}
*/
public StaticResourceServerWebExchange at(Set<StaticResourceLocation> locations) {
Assert.notNull(locations, "Locations must not be null");
Assert.notNull(locations, "'locations' must not be null");
return new StaticResourceServerWebExchange(new LinkedHashSet<>(locations));
}
@@ -115,7 +115,7 @@ public final class StaticResourceRequest {
* @return a new {@link StaticResourceServerWebExchange}
*/
public StaticResourceServerWebExchange excluding(Set<StaticResourceLocation> locations) {
Assert.notNull(locations, "Locations must not be null");
Assert.notNull(locations, "'locations' must not be null");
Set<StaticResourceLocation> subset = new LinkedHashSet<>(this.locations);
subset.removeAll(locations);
return new StaticResourceServerWebExchange(subset);

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.
@@ -86,7 +86,7 @@ public final class StaticResourceRequest {
* @return the configured {@link RequestMatcher}
*/
public StaticResourceRequestMatcher at(Set<StaticResourceLocation> locations) {
Assert.notNull(locations, "Locations must not be null");
Assert.notNull(locations, "'locations' must not be null");
return new StaticResourceRequestMatcher(new LinkedHashSet<>(locations));
}
@@ -124,7 +124,7 @@ public final class StaticResourceRequest {
* @return a new {@link StaticResourceRequestMatcher}
*/
public StaticResourceRequestMatcher excluding(Set<StaticResourceLocation> locations) {
Assert.notNull(locations, "Locations must not be null");
Assert.notNull(locations, "'locations' must not be null");
Set<StaticResourceLocation> subset = new LinkedHashSet<>(this.locations);
subset.removeAll(locations);
return new StaticResourceRequestMatcher(subset);

View File

@@ -50,7 +50,7 @@ class CertificateMatcher {
private final byte[] generatedSignature;
CertificateMatcher(PrivateKey privateKey) {
Assert.notNull(privateKey, "Private key must not be null");
Assert.notNull(privateKey, "'privateKey' must not be null");
this.privateKey = privateKey;
this.signature = createSignature(privateKey);
Assert.state(this.signature != null, "Failed to create signature");

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.
@@ -65,7 +65,7 @@ class FileWatcher implements Closeable {
* actions
*/
FileWatcher(Duration quietPeriod) {
Assert.notNull(quietPeriod, "QuietPeriod must not be null");
Assert.notNull(quietPeriod, "'quietPeriod' must not be null");
this.quietPeriod = quietPeriod;
}
@@ -75,8 +75,8 @@ class FileWatcher implements Closeable {
* @param action the action to take when changes are detected
*/
void watch(Set<Path> paths, Runnable action) {
Assert.notNull(paths, "Paths must not be null");
Assert.notNull(action, "Action must not be null");
Assert.notNull(paths, "'paths' must not be null");
Assert.notNull(action, "'action' must not be null");
if (paths.isEmpty()) {
return;
}

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.
@@ -80,7 +80,7 @@ public class TemplateAvailabilityProviders {
* @param classLoader the source class loader
*/
public TemplateAvailabilityProviders(ClassLoader classLoader) {
Assert.notNull(classLoader, "ClassLoader must not be null");
Assert.notNull(classLoader, "'classLoader' must not be null");
this.providers = SpringFactoriesLoader.loadFactories(TemplateAvailabilityProvider.class, classLoader);
}
@@ -89,7 +89,7 @@ public class TemplateAvailabilityProviders {
* @param providers the underlying providers
*/
protected TemplateAvailabilityProviders(Collection<? extends TemplateAvailabilityProvider> providers) {
Assert.notNull(providers, "Providers must not be null");
Assert.notNull(providers, "'providers' must not be null");
this.providers = new ArrayList<>(providers);
}
@@ -108,7 +108,7 @@ public class TemplateAvailabilityProviders {
* @return a {@link TemplateAvailabilityProvider} or null
*/
public TemplateAvailabilityProvider getProvider(String view, ApplicationContext applicationContext) {
Assert.notNull(applicationContext, "ApplicationContext must not be null");
Assert.notNull(applicationContext, "'applicationContext' must not be null");
return getProvider(view, applicationContext.getEnvironment(), applicationContext.getClassLoader(),
applicationContext);
}
@@ -123,10 +123,10 @@ public class TemplateAvailabilityProviders {
*/
public TemplateAvailabilityProvider getProvider(String view, Environment environment, ClassLoader classLoader,
ResourceLoader resourceLoader) {
Assert.notNull(view, "View must not be null");
Assert.notNull(environment, "Environment must not be null");
Assert.notNull(classLoader, "ClassLoader must not be null");
Assert.notNull(resourceLoader, "ResourceLoader must not be null");
Assert.notNull(view, "'view' must not be null");
Assert.notNull(environment, "'environment' must not be null");
Assert.notNull(classLoader, "'classLoader' must not be null");
Assert.notNull(resourceLoader, "'resourceLoader' must not be null");
Boolean useCache = environment.getProperty("spring.template.provider.cache", Boolean.class, true);
if (!useCache) {
return findProvider(view, environment, classLoader, resourceLoader);

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.
@@ -34,7 +34,7 @@ public class TemplateLocation {
private final String path;
public TemplateLocation(String path) {
Assert.notNull(path, "Path must not be null");
Assert.notNull(path, "'path' must not be null");
this.path = path;
}
@@ -45,7 +45,7 @@ public class TemplateLocation {
* @return {@code true} if the location exists.
*/
public boolean exists(ResourcePatternResolver resolver) {
Assert.notNull(resolver, "Resolver must not be null");
Assert.notNull(resolver, "'resolver' must not be null");
if (resolver.getResource(this.path).exists()) {
return true;
}

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 @@ public class HttpMessageConvertersRestClientCustomizer implements RestClientCust
private final Iterable<? extends HttpMessageConverter<?>> messageConverters;
public HttpMessageConvertersRestClientCustomizer(HttpMessageConverter<?>... messageConverters) {
Assert.notNull(messageConverters, "MessageConverters must not be null");
Assert.notNull(messageConverters, "'messageConverters' must not be null");
this.messageConverters = Arrays.asList(messageConverters);
}

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.
@@ -85,9 +85,9 @@ public abstract class AbstractErrorWebExceptionHandler implements ErrorWebExcept
*/
public AbstractErrorWebExceptionHandler(ErrorAttributes errorAttributes, Resources resources,
ApplicationContext applicationContext) {
Assert.notNull(errorAttributes, "ErrorAttributes must not be null");
Assert.notNull(resources, "Resources must not be null");
Assert.notNull(applicationContext, "ApplicationContext must not be null");
Assert.notNull(errorAttributes, "'errorAttributes' must not be null");
Assert.notNull(resources, "'resources' must not be null");
Assert.notNull(applicationContext, "'applicationContext' must not be null");
this.errorAttributes = errorAttributes;
this.resources = resources;
this.applicationContext = applicationContext;

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.
@@ -48,7 +48,7 @@ public interface ReactorNettyHttpClientMapper {
* @since 3.1.1
*/
static ReactorNettyHttpClientMapper of(Collection<ReactorNettyHttpClientMapper> mappers) {
Assert.notNull(mappers, "Mappers must not be null");
Assert.notNull(mappers, "'mappers' must not be null");
return of(mappers.toArray(ReactorNettyHttpClientMapper[]::new));
}
@@ -59,7 +59,7 @@ public interface ReactorNettyHttpClientMapper {
* @since 3.1.1
*/
static ReactorNettyHttpClientMapper of(ReactorNettyHttpClientMapper... mappers) {
Assert.notNull(mappers, "Mappers must not be null");
Assert.notNull(mappers, "'mappers' must not be null");
return (httpClient) -> {
for (ReactorNettyHttpClientMapper mapper : mappers) {
httpClient = mapper.configure(httpClient);

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.
@@ -42,7 +42,7 @@ public class DispatcherServletRegistrationBean extends ServletRegistrationBean<D
*/
public DispatcherServletRegistrationBean(DispatcherServlet servlet, String path) {
super(servlet);
Assert.notNull(path, "Path must not be null");
Assert.notNull(path, "'path' must not be null");
this.path = path;
super.addUrlMappings(getServletUrlMapping());
}

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.
@@ -223,8 +223,8 @@ public class WebMvcProperties {
}
public void setPath(String path) {
Assert.notNull(path, "Path must not be null");
Assert.isTrue(!path.contains("*"), "Path must not contain wildcards");
Assert.notNull(path, "'path' must not be null");
Assert.isTrue(!path.contains("*"), "'path' must not contain wildcards");
this.path = path;
}

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.
@@ -56,7 +56,7 @@ public abstract class AbstractErrorController implements ErrorController {
}
public AbstractErrorController(ErrorAttributes errorAttributes, List<ErrorViewResolver> errorViewResolvers) {
Assert.notNull(errorAttributes, "ErrorAttributes must not be null");
Assert.notNull(errorAttributes, "'errorAttributes' must not be null");
this.errorAttributes = errorAttributes;
this.errorViewResolvers = sortErrorViewResolvers(errorViewResolvers);
}

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.
@@ -78,7 +78,7 @@ public class BasicErrorController extends AbstractErrorController {
public BasicErrorController(ErrorAttributes errorAttributes, ErrorProperties errorProperties,
List<ErrorViewResolver> errorViewResolvers) {
super(errorAttributes, errorViewResolvers);
Assert.notNull(errorProperties, "ErrorProperties must not be null");
Assert.notNull(errorProperties, "'errorProperties' must not be null");
this.errorProperties = errorProperties;
}

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,9 +44,9 @@ public class WebServicesProperties {
}
public void setPath(String path) {
Assert.notNull(path, "Path must not be null");
Assert.isTrue(path.length() > 1, "Path must have length greater than 1");
Assert.isTrue(path.startsWith("/"), "Path must start with '/'");
Assert.notNull(path, "'path' must not be null");
Assert.isTrue(path.length() > 1, "'path' must have length greater than 1");
Assert.isTrue(path.startsWith("/"), "'path' must start with '/'");
this.path = path;
}

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.
@@ -448,7 +448,7 @@ class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationTests {
"spring.cache.jcache.config=" + configLocation)
.run((context) -> assertThat(context).getFailure()
.isInstanceOf(BeanCreationException.class)
.hasMessageContaining("does not exist")
.hasMessageContaining("must exist")
.hasMessageContaining(configLocation));
}

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.
@@ -69,7 +69,7 @@ class EntityScanPackagesTests {
@Test
void registerFromArrayWhenRegistryIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> EntityScanPackages.register(null))
.withMessageContaining("Registry must not be null");
.withMessageContaining("'registry' must not be null");
}
@@ -78,14 +78,14 @@ class EntityScanPackagesTests {
this.context = new AnnotationConfigApplicationContext();
assertThatIllegalArgumentException()
.isThrownBy(() -> EntityScanPackages.register(this.context, (String[]) null))
.withMessageContaining("PackageNames must not be null");
.withMessageContaining("'packageNames' must not be null");
}
@Test
void registerFromCollectionWhenRegistryIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> EntityScanPackages.register(null, Collections.emptyList()))
.withMessageContaining("Registry must not be null");
.withMessageContaining("'registry' must not be null");
}
@Test
@@ -93,7 +93,7 @@ class EntityScanPackagesTests {
this.context = new AnnotationConfigApplicationContext();
assertThatIllegalArgumentException()
.isThrownBy(() -> EntityScanPackages.register(this.context, (Collection<String>) null))
.withMessageContaining("PackageNames must not be null");
.withMessageContaining("'packageNames' 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 EntityScannerTests {
@Test
void createWhenContextIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new EntityScanner(null))
.withMessageContaining("Context must not be null");
.withMessageContaining("'context' 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.
@@ -31,21 +31,21 @@ class H2ConsolePropertiesTests {
void pathMustNotBeEmpty() {
H2ConsoleProperties properties = new H2ConsoleProperties();
assertThatIllegalArgumentException().isThrownBy(() -> properties.setPath(""))
.withMessageContaining("Path must have length greater than 1");
.withMessageContaining("'path' must have length greater than 1");
}
@Test
void pathMustHaveLengthGreaterThanOne() {
H2ConsoleProperties properties = new H2ConsoleProperties();
assertThatIllegalArgumentException().isThrownBy(() -> properties.setPath("/"))
.withMessageContaining("Path must have length greater than 1");
.withMessageContaining("'path' must have length greater than 1");
}
@Test
void customPathMustBeginWithASlash() {
H2ConsoleProperties properties = new H2ConsoleProperties();
assertThatIllegalArgumentException().isThrownBy(() -> properties.setPath("custom"))
.withMessageContaining("Path must start with '/'");
.withMessageContaining("'path' must start with '/'");
}
}

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.
@@ -53,7 +53,7 @@ class DefaultExceptionTranslatorExecuteListenerTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> new DefaultExceptionTranslatorExecuteListener(
(Function<ExecuteContext, SQLExceptionTranslator>) null))
.withMessage("TranslatorFactory must not be null");
.withMessage("'translatorFactory' must not be null");
}
@ParameterizedTest(name = "{0}")

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 ConditionEvaluationReportLoggerTests {
void supportsOnlyInfoAndDebugLogLevels() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new ConditionEvaluationReportLogger(LogLevel.TRACE, () -> null))
.withMessageContaining("LogLevel must be INFO or DEBUG");
.withMessageContaining("'logLevel' must be INFO or DEBUG");
}
@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.
@@ -226,7 +226,7 @@ class PulsarPropertiesTests {
map.put("spring.pulsar.defaults.type-mappings[0].schema-info.message-key-type", String.class.getName());
assertThatExceptionOfType(BindException.class).isThrownBy(() -> bindProperties(map))
.havingRootCause()
.withMessageContaining("schemaType must not be null");
.withMessageContaining("'schemaType' must not be null");
}
@Test
@@ -236,7 +236,7 @@ class PulsarPropertiesTests {
map.put("spring.pulsar.defaults.type-mappings[0].schema-info.schema-type", "NONE");
assertThatExceptionOfType(BindException.class).isThrownBy(() -> bindProperties(map))
.havingRootCause()
.withMessageContaining("schemaType 'NONE' not supported");
.withMessageContaining("'schemaType' must not be NONE");
}
@Test
@@ -247,7 +247,7 @@ class PulsarPropertiesTests {
map.put("spring.pulsar.defaults.type-mappings[0].schema-info.message-key-type", String.class.getName());
assertThatExceptionOfType(BindException.class).isThrownBy(() -> bindProperties(map))
.havingRootCause()
.withMessageContaining("messageKeyType can only be set when schemaType is KEY_VALUE");
.withMessageContaining("'messageKeyType' can only be set when 'schemaType' is KEY_VALUE");
}
record TestMessage(String value) {

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.
@@ -78,13 +78,13 @@ class StaticResourceRequestTests {
@Test
void atLocationsFromSetWhenSetIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.resourceRequest.at(null))
.withMessageContaining("Locations must not be null");
.withMessageContaining("'locations' must not be null");
}
@Test
void excludeFromSetWhenSetIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.resourceRequest.atCommonLocations().excluding(null))
.withMessageContaining("Locations must not be null");
.withMessageContaining("'locations' must not be null");
}
private RequestMatcherAssert assertMatcher(ServerWebExchangeMatcher matcher) {

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.
@@ -87,13 +87,13 @@ class StaticResourceRequestTests {
@Test
void atLocationsFromSetWhenSetIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.resourceRequest.at(null))
.withMessageContaining("Locations must not be null");
.withMessageContaining("'locations' must not be null");
}
@Test
void excludeFromSetWhenSetIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.resourceRequest.atCommonLocations().excluding(null))
.withMessageContaining("Locations must not be null");
.withMessageContaining("'locations' must not be null");
}
private RequestMatcherAssert assertMatcher(RequestMatcher matcher) {

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,7 +67,7 @@ class TemplateAvailabilityProvidersTests {
void createWhenApplicationContextIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new TemplateAvailabilityProviders((ApplicationContext) null))
.withMessageContaining("ClassLoader must not be null");
.withMessageContaining("'classLoader' must not be null");
}
@Test
@@ -82,7 +82,7 @@ class TemplateAvailabilityProvidersTests {
@Test
void createWhenClassLoaderIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new TemplateAvailabilityProviders((ClassLoader) null))
.withMessageContaining("ClassLoader must not be null");
.withMessageContaining("'classLoader' must not be null");
}
@Test
@@ -95,7 +95,7 @@ class TemplateAvailabilityProvidersTests {
void createWhenProvidersIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new TemplateAvailabilityProviders((Collection<TemplateAvailabilityProvider>) null))
.withMessageContaining("Providers must not be null");
.withMessageContaining("'providers' must not be null");
}
@Test
@@ -108,35 +108,35 @@ class TemplateAvailabilityProvidersTests {
@Test
void getProviderWhenApplicationContextIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.providers.getProvider(this.view, null))
.withMessageContaining("ApplicationContext must not be null");
.withMessageContaining("'applicationContext' must not be null");
}
@Test
void getProviderWhenViewIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> this.providers.getProvider(null, this.environment, this.classLoader, this.resourceLoader))
.withMessageContaining("View must not be null");
.withMessageContaining("'view' must not be null");
}
@Test
void getProviderWhenEnvironmentIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> this.providers.getProvider(this.view, null, this.classLoader, this.resourceLoader))
.withMessageContaining("Environment must not be null");
.withMessageContaining("'environment' must not be null");
}
@Test
void getProviderWhenClassLoaderIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> this.providers.getProvider(this.view, this.environment, null, this.resourceLoader))
.withMessageContaining("ClassLoader must not be null");
.withMessageContaining("'classLoader' must not be null");
}
@Test
void getProviderWhenResourceLoaderIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> this.providers.getProvider(this.view, this.environment, this.classLoader, null))
.withMessageContaining("ResourceLoader must not be null");
.withMessageContaining("'resourceLoader' 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.
@@ -44,7 +44,7 @@ class HttpMessageConvertersRestClientCustomizerTests {
void createWhenNullMessageConvertersArrayThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new HttpMessageConvertersRestClientCustomizer((HttpMessageConverter<?>[]) null))
.withMessage("MessageConverters must not be null");
.withMessage("'messageConverters' 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.
@@ -47,7 +47,7 @@ class ReactorNettyHttpClientMapperTests {
void ofWhenCollectionIsNullThrowsException() {
Collection<ReactorNettyHttpClientMapper> mappers = null;
assertThatIllegalArgumentException().isThrownBy(() -> ReactorNettyHttpClientMapper.of(mappers))
.withMessage("Mappers must not be null");
.withMessage("'mappers' must not be null");
}
@Test
@@ -64,7 +64,7 @@ class ReactorNettyHttpClientMapperTests {
void ofWhenArrayIsNullThrowsException() {
ReactorNettyHttpClientMapper[] mappers = null;
assertThatIllegalArgumentException().isThrownBy(() -> ReactorNettyHttpClientMapper.of(mappers))
.withMessage("Mappers must not be null");
.withMessage("'mappers' must not be null");
}
private static class TestHttpClient extends HttpClient {

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 DispatcherServletRegistrationBeanTests {
void createWhenPathIsNullThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new DispatcherServletRegistrationBean(new DispatcherServlet(), null))
.withMessageContaining("Path must not be null");
.withMessageContaining("'path' 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.
@@ -58,7 +58,7 @@ class WebMvcPropertiesTests {
void servletPathWhenHasWildcardThrowsException() {
assertThatExceptionOfType(BindException.class).isThrownBy(() -> bind("spring.mvc.servlet.path", "/*"))
.withRootCauseInstanceOf(IllegalArgumentException.class)
.satisfies((ex) -> assertThat(Throwables.getRootCause(ex)).hasMessage("Path must not contain wildcards"));
.satisfies((ex) -> assertThat(Throwables.getRootCause(ex)).hasMessage("'path' must not contain wildcards"));
}
private void bind(String name, String value) {

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,7 +54,7 @@ class WebServicesAutoConfigurationTests {
.run((context) -> assertThat(context).getFailure()
.isInstanceOf(BeanCreationException.class)
.rootCause()
.hasMessageContaining("Path must start with '/'"));
.hasMessageContaining("'path' must start with '/'"));
}
@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.
@@ -33,21 +33,21 @@ class WebServicesPropertiesTests {
void pathMustNotBeEmpty() {
this.properties = new WebServicesProperties();
assertThatIllegalArgumentException().isThrownBy(() -> this.properties.setPath(""))
.withMessageContaining("Path must have length greater than 1");
.withMessageContaining("'path' must have length greater than 1");
}
@Test
void pathMustHaveLengthGreaterThanOne() {
this.properties = new WebServicesProperties();
assertThatIllegalArgumentException().isThrownBy(() -> this.properties.setPath("/"))
.withMessageContaining("Path must have length greater than 1");
.withMessageContaining("'path' must have length greater than 1");
}
@Test
void customPathMustBeginWithASlash() {
this.properties = new WebServicesProperties();
assertThatIllegalArgumentException().isThrownBy(() -> this.properties.setPath("custom"))
.withMessageContaining("Path must start with '/'");
.withMessageContaining("'path' must start with '/'");
}
}