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:
@@ -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,7 +77,7 @@ public class TestcontainersPropertySource extends MapPropertySource {
|
||||
DynamicPropertyRegistryInjection registryInjection) {
|
||||
super(NAME, Collections.unmodifiableMap(valueSuppliers));
|
||||
this.registry = (name, valueSupplier) -> {
|
||||
Assert.hasText(name, "'name' must not be null or blank");
|
||||
Assert.hasText(name, "'name' must not be empty");
|
||||
DynamicPropertyRegistryInjectionException.throwIfNecessary(name, registryInjection);
|
||||
Assert.notNull(valueSupplier, "'valueSupplier' must not be null");
|
||||
valueSuppliers.put(name, valueSupplier);
|
||||
|
||||
@@ -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.
|
||||
@@ -92,7 +92,7 @@ public abstract class ContainerConnectionDetailsFactory<C extends Container<?>,
|
||||
* @since 3.4.0
|
||||
*/
|
||||
protected ContainerConnectionDetailsFactory(List<String> connectionNames, String... requiredClassNames) {
|
||||
Assert.notEmpty(connectionNames, "ConnectionNames must contain at least one name");
|
||||
Assert.notEmpty(connectionNames, "'connectionNames' must not be empty");
|
||||
this.connectionNames = connectionNames;
|
||||
this.requiredClassNames = requiredClassNames;
|
||||
}
|
||||
@@ -171,7 +171,7 @@ public abstract class ContainerConnectionDetailsFactory<C extends Container<?>,
|
||||
* @param source the source {@link ContainerConnectionSource}
|
||||
*/
|
||||
protected ContainerConnectionDetails(ContainerConnectionSource<C> source) {
|
||||
Assert.notNull(source, "Source must not be null");
|
||||
Assert.notNull(source, "'source' must not be null");
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -34,7 +34,7 @@ class FieldOrigin implements Origin {
|
||||
private final Field field;
|
||||
|
||||
FieldOrigin(Field field) {
|
||||
Assert.notNull(field, "Field must not be null");
|
||||
Assert.notNull(field, "'field' must not be null");
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,7 +36,7 @@ class FieldOriginTests {
|
||||
@Test
|
||||
void createWhenFieldIsNullThrowsException() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> new FieldOrigin(null))
|
||||
.withMessage("Field must not be null");
|
||||
.withMessage("'field' must not be null");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user