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.
@@ -49,7 +49,7 @@ public final class AnnotatedClassFinder {
* @param annotationType the annotation to find
*/
public AnnotatedClassFinder(Class<? extends Annotation> annotationType) {
Assert.notNull(annotationType, "AnnotationType must not be null");
Assert.notNull(annotationType, "'annotationType' must not be null");
this.annotationType = annotationType;
this.scanner = new ClassPathScanningCandidateComponentProvider(false);
this.scanner.addIncludeFilter(new AnnotationTypeFilter(annotationType));
@@ -64,7 +64,7 @@ public final class AnnotatedClassFinder {
* hierarchy defined by the given {@code source} or {@code null} if none is found.
*/
public Class<?> findFromClass(Class<?> source) {
Assert.notNull(source, "Source must not be null");
Assert.notNull(source, "'source' must not be null");
return findFromPackage(ClassUtils.getPackageName(source));
}
@@ -76,7 +76,7 @@ public final class AnnotatedClassFinder {
* hierarchy defined by the given {@code source} or {@code null} if none is found.
*/
public Class<?> findFromPackage(String source) {
Assert.notNull(source, "Source must not be null");
Assert.notNull(source, "'source' must not be null");
Class<?> configuration = cache.get(source);
if (configuration == null) {
configuration = scanPackage(source);

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 @@ public class ApplicationContextAssert<C extends ApplicationContext>
*/
ApplicationContextAssert(C applicationContext, Throwable startupFailure) {
super(applicationContext, ApplicationContextAssert.class);
Assert.notNull(applicationContext, "ApplicationContext must not be null");
Assert.notNull(applicationContext, "'applicationContext' must not be null");
this.startupFailure = startupFailure;
}
@@ -121,7 +121,7 @@ public class ApplicationContextAssert<C extends ApplicationContext>
* given type
*/
public ApplicationContextAssert<C> hasSingleBean(Class<?> type, Scope scope) {
Assert.notNull(scope, "Scope must not be null");
Assert.notNull(scope, "'scope' must not be null");
if (this.startupFailure != null) {
throwAssertionError(contextFailedToStartWhenExpecting("to have a single bean of type:%n <%s>", type));
}
@@ -168,7 +168,7 @@ public class ApplicationContextAssert<C extends ApplicationContext>
* type
*/
public ApplicationContextAssert<C> doesNotHaveBean(Class<?> type, Scope scope) {
Assert.notNull(scope, "Scope must not be null");
Assert.notNull(scope, "'scope' must not be null");
if (this.startupFailure != null) {
throwAssertionError(contextFailedToStartWhenExpecting("not to have any beans of type:%n <%s>", type));
}
@@ -265,7 +265,7 @@ public class ApplicationContextAssert<C extends ApplicationContext>
* given type
*/
public <T> AbstractObjectAssert<?, T> getBean(Class<T> type, Scope scope) {
Assert.notNull(scope, "Scope must not be null");
Assert.notNull(scope, "'scope' must not be null");
if (this.startupFailure != null) {
throwAssertionError(contextFailedToStartWhenExpecting("to contain bean of type:%n <%s>", type));
}
@@ -407,7 +407,7 @@ public class ApplicationContextAssert<C extends ApplicationContext>
* @throws AssertionError if the application context did not start
*/
public <T> MapAssert<String, T> getBeans(Class<T> type, Scope scope) {
Assert.notNull(scope, "Scope must not be null");
Assert.notNull(scope, "'scope' must not be null");
if (this.startupFailure != null) {
throwAssertionError(contextFailedToStartWhenExpecting("to get beans of type:%n <%s>", type));
}

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.
@@ -127,10 +127,10 @@ public interface ApplicationContextAssertProvider<C extends ApplicationContext>
static <T extends ApplicationContextAssertProvider<C>, C extends ApplicationContext> T get(Class<T> type,
Class<? extends C> contextType, Supplier<? extends C> contextSupplier,
Class<?>... additionalContextInterfaces) {
Assert.notNull(type, "Type must not be null");
Assert.isTrue(type.isInterface(), "Type must be an interface");
Assert.notNull(contextType, "ContextType must not be null");
Assert.isTrue(contextType.isInterface(), "ContextType must be an interface");
Assert.notNull(type, "'type' must not be null");
Assert.isTrue(type.isInterface(), "'type' must be an interface");
Assert.notNull(contextType, "'contextType' must not be null");
Assert.isTrue(contextType.isInterface(), "'contextType' must be an interface");
Class<?>[] interfaces = merge(new Class<?>[] { type, contextType }, additionalContextInterfaces);
return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces,
new AssertProviderApplicationContextInvocationHandler(contextType, contextSupplier));

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.
@@ -154,8 +154,8 @@ public abstract class AbstractApplicationContextRunner<SELF extends AbstractAppl
*/
protected AbstractApplicationContextRunner(RunnerConfiguration<C> configuration,
Function<RunnerConfiguration<C>, SELF> instanceFactory) {
Assert.notNull(configuration, "RunnerConfiguration must not be null");
Assert.notNull(instanceFactory, "instanceFactory must not be null");
Assert.notNull(configuration, "'configuration' must not be null");
Assert.notNull(instanceFactory, "'instanceFactory' must not be null");
this.runnerConfiguration = configuration;
this.instanceFactory = instanceFactory;
}
@@ -190,7 +190,7 @@ public abstract class AbstractApplicationContextRunner<SELF extends AbstractAppl
* @return a new instance with the updated initializers
*/
public SELF withInitializer(ApplicationContextInitializer<? super C> initializer) {
Assert.notNull(initializer, "Initializer must not be null");
Assert.notNull(initializer, "'initializer' must not be null");
return newInstance(this.runnerConfiguration.withInitializer(initializer));
}
@@ -332,7 +332,7 @@ public abstract class AbstractApplicationContextRunner<SELF extends AbstractAppl
* @return a new instance with the updated configuration
*/
public SELF withConfiguration(Configurations configurations) {
Assert.notNull(configurations, "Configurations must not be null");
Assert.notNull(configurations, "'configurations' must not be null");
return newInstance(this.runnerConfiguration.withConfiguration(configurations));
}
@@ -559,7 +559,7 @@ public abstract class AbstractApplicationContextRunner<SELF extends AbstractAppl
}
private RunnerConfiguration<C> withInitializer(ApplicationContextInitializer<? super C> initializer) {
Assert.notNull(initializer, "Initializer must not be null");
Assert.notNull(initializer, "'initializer' must not be null");
RunnerConfiguration<C> config = new RunnerConfiguration<>(this);
config.initializers = add(config.initializers, initializer);
return config;
@@ -605,7 +605,7 @@ public abstract class AbstractApplicationContextRunner<SELF extends AbstractAppl
}
private RunnerConfiguration<C> withConfiguration(Configurations configurations) {
Assert.notNull(configurations, "Configurations must not be null");
Assert.notNull(configurations, "'configurations' must not be null");
RunnerConfiguration<C> config = new RunnerConfiguration<>(this);
config.configurations = add(config.configurations, configurations);
return config;

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 interface ContextConsumer<C extends ApplicationContext> {
* @since 2.6.0
*/
default ContextConsumer<C> andThen(ContextConsumer<? super C> after) {
Assert.notNull(after, "After must not be null");
Assert.notNull(after, "'after' must not be null");
return (context) -> {
accept(context);
after.accept(context);

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,8 +85,8 @@ public abstract class AbstractJsonMarshalTester<T> {
* @param type the type under test
*/
public AbstractJsonMarshalTester(Class<?> resourceLoadClass, ResolvableType type) {
Assert.notNull(resourceLoadClass, "ResourceLoadClass must not be null");
Assert.notNull(type, "Type must not be null");
Assert.notNull(resourceLoadClass, "'resourceLoadClass' must not be null");
Assert.notNull(type, "'type' must not be null");
initialize(resourceLoadClass, type);
}
@@ -127,7 +127,7 @@ public abstract class AbstractJsonMarshalTester<T> {
*/
public JsonContent<T> write(T value) throws IOException {
verify();
Assert.notNull(value, "Value must not be null");
Assert.notNull(value, "'value' must not be null");
String json = writeObject(value, this.type);
return getJsonContent(json);
}
@@ -162,7 +162,7 @@ public abstract class AbstractJsonMarshalTester<T> {
*/
public ObjectContent<T> parse(byte[] jsonBytes) throws IOException {
verify();
Assert.notNull(jsonBytes, "JsonBytes must not be null");
Assert.notNull(jsonBytes, "'jsonBytes' must not be null");
return read(new ByteArrayResource(jsonBytes));
}
@@ -185,7 +185,7 @@ public abstract class AbstractJsonMarshalTester<T> {
*/
public ObjectContent<T> parse(String jsonString) throws IOException {
verify();
Assert.notNull(jsonString, "JsonString must not be null");
Assert.notNull(jsonString, "'jsonString' must not be null");
return read(new StringReader(jsonString));
}
@@ -210,7 +210,7 @@ public abstract class AbstractJsonMarshalTester<T> {
*/
public ObjectContent<T> read(String resourcePath) throws IOException {
verify();
Assert.notNull(resourcePath, "ResourcePath must not be null");
Assert.notNull(resourcePath, "'resourcePath' must not be null");
return read(new ClassPathResource(resourcePath, this.resourceLoadClass));
}
@@ -233,7 +233,7 @@ public abstract class AbstractJsonMarshalTester<T> {
*/
public ObjectContent<T> read(File file) throws IOException {
verify();
Assert.notNull(file, "File must not be null");
Assert.notNull(file, "'file' must not be null");
return read(new FileSystemResource(file));
}
@@ -256,7 +256,7 @@ public abstract class AbstractJsonMarshalTester<T> {
*/
public ObjectContent<T> read(InputStream inputStream) throws IOException {
verify();
Assert.notNull(inputStream, "InputStream must not be null");
Assert.notNull(inputStream, "'inputStream' must not be null");
return read(new InputStreamResource(inputStream));
}
@@ -279,7 +279,7 @@ public abstract class AbstractJsonMarshalTester<T> {
*/
public ObjectContent<T> read(Resource resource) throws IOException {
verify();
Assert.notNull(resource, "Resource must not be null");
Assert.notNull(resource, "'resource' must not be null");
InputStream inputStream = resource.getInputStream();
T object = readObject(inputStream, this.type);
closeQuietly(inputStream);
@@ -305,7 +305,7 @@ public abstract class AbstractJsonMarshalTester<T> {
*/
public ObjectContent<T> read(Reader reader) throws IOException {
verify();
Assert.notNull(reader, "Reader must not be null");
Assert.notNull(reader, "'reader' must not be null");
T object = readObject(reader, this.type);
closeQuietly(reader);
return new ObjectContent<>(this.type, object);
@@ -368,19 +368,19 @@ public abstract class AbstractJsonMarshalTester<T> {
@SuppressWarnings("rawtypes")
protected FieldInitializer(Class<? extends AbstractJsonMarshalTester> testerClass) {
Assert.notNull(testerClass, "TesterClass must not be null");
Assert.notNull(testerClass, "'testerClass' must not be null");
this.testerClass = testerClass;
}
public void initFields(Object testInstance, M marshaller) {
Assert.notNull(testInstance, "TestInstance must not be null");
Assert.notNull(marshaller, "Marshaller must not be null");
Assert.notNull(testInstance, "'testInstance' must not be null");
Assert.notNull(marshaller, "'marshaller' must not be null");
initFields(testInstance, () -> marshaller);
}
public void initFields(Object testInstance, final ObjectFactory<M> marshaller) {
Assert.notNull(testInstance, "TestInstance must not be null");
Assert.notNull(marshaller, "Marshaller must not be null");
Assert.notNull(testInstance, "'testInstance' must not be null");
Assert.notNull(marshaller, "'marshaller' must not be null");
ReflectionUtils.doWithFields(testInstance.getClass(),
(field) -> doWithField(field, testInstance, marshaller));
}

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.
@@ -70,7 +70,7 @@ public class BasicJsonTester {
* @since 1.4.1
*/
public BasicJsonTester(Class<?> resourceLoadClass, Charset charset) {
Assert.notNull(resourceLoadClass, "ResourceLoadClass must not be null");
Assert.notNull(resourceLoadClass, "'resourceLoadClass' must not be null");
this.loader = new JsonLoader(resourceLoadClass, charset);
}

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.
@@ -62,7 +62,7 @@ public class GsonTester<T> extends AbstractJsonMarshalTester<T> {
* @param gson the Gson instance
*/
protected GsonTester(Gson gson) {
Assert.notNull(gson, "Gson must not be null");
Assert.notNull(gson, "'gson' must not be null");
this.gson = gson;
}
@@ -75,7 +75,7 @@ public class GsonTester<T> extends AbstractJsonMarshalTester<T> {
*/
public GsonTester(Class<?> resourceLoadClass, ResolvableType type, Gson gson) {
super(resourceLoadClass, type);
Assert.notNull(gson, "Gson must not be null");
Assert.notNull(gson, "'gson' must not be null");
this.gson = gson;
}

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.
@@ -73,7 +73,7 @@ public class JacksonTester<T> extends AbstractJsonMarshalTester<T> {
* @param objectMapper the Jackson object mapper
*/
protected JacksonTester(ObjectMapper objectMapper) {
Assert.notNull(objectMapper, "ObjectMapper must not be null");
Assert.notNull(objectMapper, "'objectMapper' must not be null");
this.objectMapper = objectMapper;
}
@@ -89,7 +89,7 @@ public class JacksonTester<T> extends AbstractJsonMarshalTester<T> {
public JacksonTester(Class<?> resourceLoadClass, ResolvableType type, ObjectMapper objectMapper, Class<?> view) {
super(resourceLoadClass, type);
Assert.notNull(objectMapper, "ObjectMapper must not be null");
Assert.notNull(objectMapper, "'objectMapper' must not be null");
this.objectMapper = objectMapper;
this.view = view;
}

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.
@@ -60,9 +60,9 @@ public final class JsonContent<T> implements AssertProvider<JsonContentAssert> {
* @param configuration the JsonPath configuration
*/
JsonContent(Class<?> resourceLoadClass, ResolvableType type, String json, Configuration configuration) {
Assert.notNull(resourceLoadClass, "ResourceLoadClass must not be null");
Assert.notNull(json, "JSON must not be null");
Assert.notNull(configuration, "Configuration must not be null");
Assert.notNull(resourceLoadClass, "'resourceLoadClass' must not be null");
Assert.notNull(json, "'json' must not be null");
Assert.notNull(configuration, "'configuration' must not be null");
this.resourceLoadClass = resourceLoadClass;
this.type = type;
this.json = json;

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.
@@ -1060,7 +1060,7 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
JsonPathValue(CharSequence expression, Object... args) {
org.springframework.util.Assert.hasText((expression != null) ? expression.toString() : null,
"expression must not be null or empty");
"'expression' must not be empty");
this.expression = String.format(expression.toString(), args);
this.jsonPath = JsonPath.compile(this.expression);
}

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.
@@ -62,7 +62,7 @@ public class JsonbTester<T> extends AbstractJsonMarshalTester<T> {
* @param jsonb the Jsonb instance
*/
protected JsonbTester(Jsonb jsonb) {
Assert.notNull(jsonb, "Jsonb must not be null");
Assert.notNull(jsonb, "'jsonb' must not be null");
this.jsonb = jsonb;
}
@@ -75,7 +75,7 @@ public class JsonbTester<T> extends AbstractJsonMarshalTester<T> {
*/
public JsonbTester(Class<?> resourceLoadClass, ResolvableType type, Jsonb jsonb) {
super(resourceLoadClass, type);
Assert.notNull(jsonb, "Jsonb must not be null");
Assert.notNull(jsonb, "'jsonb' must not be null");
this.jsonb = jsonb;
}

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 final class ObjectContent<T> implements AssertProvider<ObjectContentAsser
* @param object the actual object content
*/
public ObjectContent(ResolvableType type, T object) {
Assert.notNull(object, "Object must not be null");
Assert.notNull(object, "'object' must not be null");
this.type = type;
this.object = object;
}

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 @@ class MockDefinition extends Definition {
MockDefinition(String name, ResolvableType typeToMock, Class<?>[] extraInterfaces, Answers answer,
boolean serializable, MockReset reset, QualifierDefinition qualifier) {
super(name, reset, false, qualifier);
Assert.notNull(typeToMock, "TypeToMock must not be null");
Assert.notNull(typeToMock, "'typeToMock' must not be null");
this.typeToMock = typeToMock;
this.extraInterfaces = asClassSet(extraInterfaces);
this.answer = (answer != null) ? answer : Answers.RETURNS_DEFAULTS;

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.
@@ -92,7 +92,7 @@ public enum MockReset {
* @return the configured settings
*/
public static MockSettings apply(MockReset reset, MockSettings settings) {
Assert.notNull(settings, "Settings must not be null");
Assert.notNull(settings, "'settings' must not be null");
if (reset != null && reset != NONE) {
settings.invocationListeners(new ResetInvocationListener(reset));
}

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.
@@ -123,15 +123,14 @@ public class MockitoPostProcessor implements InstantiationAwareBeanPostProcessor
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
Assert.isInstanceOf(ConfigurableListableBeanFactory.class, beanFactory,
"Mock beans can only be used with a ConfigurableListableBeanFactory");
Assert.isTrue(beanFactory instanceof ConfigurableListableBeanFactory,
"'beanFactory' must be a ConfigurableListableBeanFactory");
this.beanFactory = beanFactory;
}
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
Assert.isInstanceOf(BeanDefinitionRegistry.class, beanFactory,
"@MockBean can only be used on bean factories that implement BeanDefinitionRegistry");
Assert.isTrue(beanFactory instanceof BeanDefinitionRegistry, "'beanFactory' must be a BeanDefinitionRegistry");
postProcessBeanFactory(beanFactory, (BeanDefinitionRegistry) beanFactory);
}

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.
@@ -50,7 +50,7 @@ class SpyDefinition extends Definition {
SpyDefinition(String name, ResolvableType typeToSpy, MockReset reset, boolean proxyTargetAware,
QualifierDefinition qualifier) {
super(name, reset, proxyTargetAware, qualifier);
Assert.notNull(typeToSpy, "TypeToSpy must not be null");
Assert.notNull(typeToSpy, "'typeToSpy' must not be null");
this.typeToSpy = typeToSpy;
}
@@ -94,7 +94,7 @@ class SpyDefinition extends Definition {
@SuppressWarnings("unchecked")
<T> T createSpy(String name, Object instance) {
Assert.notNull(instance, "Instance must not be null");
Assert.notNull(instance, "'instance' must not be null");
Assert.isInstanceOf(this.typeToSpy.resolve(), instance);
if (Mockito.mockingDetails(instance).isSpy()) {
return (T) instance;

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.
@@ -155,9 +155,9 @@ public final class TestPropertyValues {
* @param name the name for the property source
*/
public void applyTo(ConfigurableEnvironment environment, Type type, String name) {
Assert.notNull(environment, "Environment must not be null");
Assert.notNull(type, "Property source type must not be null");
Assert.notNull(name, "Property source name must not be null");
Assert.notNull(environment, "'environment' must not be null");
Assert.notNull(type, "'type' must not be null");
Assert.notNull(name, "'name' must not be null");
MutablePropertySources sources = environment.getPropertySources();
addToSources(sources, type, name);
ConfigurationPropertySources.attach(environment);
@@ -324,7 +324,7 @@ public final class TestPropertyValues {
private final String value;
private Pair(String name, String value) {
Assert.hasLength(name, "Name must not be empty");
Assert.hasLength(name, "'name' must not be empty");
this.name = name;
this.value = value;
}
@@ -401,7 +401,7 @@ public final class TestPropertyValues {
}
private String setOrClear(String name, String value) {
Assert.notNull(name, "Name must not be null");
Assert.notNull(name, "'name' must not be null");
if (!StringUtils.hasLength(value)) {
return (String) System.getProperties().remove(name);
}

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.
@@ -72,8 +72,8 @@ public class LocalHostUriTemplateHandler extends RootUriTemplateHandler {
*/
public LocalHostUriTemplateHandler(Environment environment, String scheme, UriTemplateHandler handler) {
super(handler);
Assert.notNull(environment, "Environment must not be null");
Assert.notNull(scheme, "Scheme must not be null");
Assert.notNull(environment, "'environment' must not be null");
Assert.notNull(scheme, "'scheme' must not be null");
this.environment = environment;
this.scheme = scheme;
}

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 MockServerRestClientCustomizer implements RestClientCustomizer {
*/
public MockServerRestClientCustomizer(Class<? extends RequestExpectationManager> expectationManager) {
this(() -> BeanUtils.instantiateClass(expectationManager));
Assert.notNull(expectationManager, "ExpectationManager must not be null");
Assert.notNull(expectationManager, "'expectationManager' must not be null");
}
/**
@@ -90,7 +90,7 @@ public class MockServerRestClientCustomizer implements RestClientCustomizer {
* @since 3.0.0
*/
public MockServerRestClientCustomizer(Supplier<? extends RequestExpectationManager> expectationManagerSupplier) {
Assert.notNull(expectationManagerSupplier, "ExpectationManagerSupplier must not be null");
Assert.notNull(expectationManagerSupplier, "'expectationManagerSupplier' must not be null");
this.expectationManagerSupplier = expectationManagerSupplier;
}

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.
@@ -82,7 +82,7 @@ public class MockServerRestTemplateCustomizer implements RestTemplateCustomizer
*/
public MockServerRestTemplateCustomizer(Class<? extends RequestExpectationManager> expectationManager) {
this(() -> BeanUtils.instantiateClass(expectationManager));
Assert.notNull(expectationManager, "ExpectationManager must not be null");
Assert.notNull(expectationManager, "'expectationManager' must not be null");
}
/**
@@ -92,7 +92,7 @@ public class MockServerRestTemplateCustomizer implements RestTemplateCustomizer
* @since 3.0.0
*/
public MockServerRestTemplateCustomizer(Supplier<? extends RequestExpectationManager> expectationManagerSupplier) {
Assert.notNull(expectationManagerSupplier, "ExpectationManagerSupplier must not be null");
Assert.notNull(expectationManagerSupplier, "'expectationManagerSupplier' must not be null");
this.expectationManagerSupplier = expectationManagerSupplier;
}

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,8 +61,8 @@ public class RootUriRequestExpectationManager implements RequestExpectationManag
private final RequestExpectationManager expectationManager;
public RootUriRequestExpectationManager(String rootUri, RequestExpectationManager expectationManager) {
Assert.notNull(rootUri, "RootUri must not be null");
Assert.notNull(expectationManager, "ExpectationManager must not be null");
Assert.notNull(rootUri, "'rootUri' must not be null");
Assert.notNull(expectationManager, "'expectationManager' must not be null");
this.rootUri = rootUri;
this.expectationManager = expectationManager;
}
@@ -156,7 +156,7 @@ public class RootUriRequestExpectationManager implements RequestExpectationManag
*/
public static RequestExpectationManager forRestTemplate(RestTemplate restTemplate,
RequestExpectationManager expectationManager) {
Assert.notNull(restTemplate, "RestTemplate must not be null");
Assert.notNull(restTemplate, "'restTemplate' must not be null");
UriTemplateHandler templateHandler = restTemplate.getUriTemplateHandler();
if (templateHandler instanceof RootUriTemplateHandler rootHandler) {
return new RootUriRequestExpectationManager(rootHandler.getRootUri(), expectationManager);

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.
@@ -154,7 +154,7 @@ public class TestRestTemplate {
private static RestTemplateBuilder createInitialBuilder(RestTemplateBuilder builder, String username,
String password, HttpClientOption... httpClientOptions) {
Assert.notNull(builder, "Builder must not be null");
Assert.notNull(builder, "'builder' must not be null");
if (httpClientOptions != null) {
ClientHttpRequestFactory requestFactory = builder.buildRequestFactory();
if (requestFactory instanceof HttpComponentsClientHttpRequestFactory) {

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.
@@ -37,7 +37,7 @@ public class LocalHostWebClient extends WebClient {
private final Environment environment;
public LocalHostWebClient(Environment environment) {
Assert.notNull(environment, "Environment must not be null");
Assert.notNull(environment, "'environment' must not be null");
this.environment = environment;
}

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,25 +35,25 @@ public class LocalHostWebConnectionHtmlUnitDriver extends WebConnectionHtmlUnitD
private final Environment environment;
public LocalHostWebConnectionHtmlUnitDriver(Environment environment) {
Assert.notNull(environment, "Environment must not be null");
Assert.notNull(environment, "'environment' must not be null");
this.environment = environment;
}
public LocalHostWebConnectionHtmlUnitDriver(Environment environment, boolean enableJavascript) {
super(enableJavascript);
Assert.notNull(environment, "Environment must not be null");
Assert.notNull(environment, "'environment' must not be null");
this.environment = environment;
}
public LocalHostWebConnectionHtmlUnitDriver(Environment environment, BrowserVersion browserVersion) {
super(browserVersion);
Assert.notNull(environment, "Environment must not be null");
Assert.notNull(environment, "'environment' must not be null");
this.environment = environment;
}
public LocalHostWebConnectionHtmlUnitDriver(Environment environment, Capabilities capabilities) {
super(capabilities);
Assert.notNull(environment, "Environment must not be null");
Assert.notNull(environment, "'environment' must not be null");
this.environment = environment;
}

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,13 +37,13 @@ class AnnotatedClassFinderTests {
@Test
void findFromClassWhenSourceIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.finder.findFromClass((Class<?>) null))
.withMessageContaining("Source must not be null");
.withMessageContaining("'source' must not be null");
}
@Test
void findFromPackageWhenSourceIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.finder.findFromPackage((String) null))
.withMessageContaining("Source must not be null");
.withMessageContaining("'source' 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.
@@ -64,14 +64,14 @@ class ApplicationContextAssertProviderTests {
void getWhenTypeIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(
() -> ApplicationContextAssertProvider.get(null, ApplicationContext.class, this.mockContextSupplier))
.withMessageContaining("Type must not be null");
.withMessageContaining("'type' must not be null");
}
@Test
void getWhenTypeIsClassShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(
() -> ApplicationContextAssertProvider.get(null, ApplicationContext.class, this.mockContextSupplier))
.withMessageContaining("Type must not be null");
.withMessageContaining("'type' must not be null");
}
@Test
@@ -79,7 +79,7 @@ class ApplicationContextAssertProviderTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> ApplicationContextAssertProvider.get(TestAssertProviderApplicationContextClass.class,
ApplicationContext.class, this.mockContextSupplier))
.withMessageContaining("Type must be an interface");
.withMessageContaining("'type' must be an interface");
}
@Test
@@ -87,7 +87,7 @@ class ApplicationContextAssertProviderTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> ApplicationContextAssertProvider.get(TestAssertProviderApplicationContext.class, null,
this.mockContextSupplier))
.withMessageContaining("ContextType must not be null");
.withMessageContaining("'contextType' must not be null");
}
@Test
@@ -95,7 +95,7 @@ class ApplicationContextAssertProviderTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> ApplicationContextAssertProvider.get(TestAssertProviderApplicationContext.class,
StaticApplicationContext.class, this.mockContextSupplier))
.withMessageContaining("ContextType must be an interface");
.withMessageContaining("'contextType' must be an interface");
}
@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.
@@ -62,7 +62,7 @@ class ApplicationContextAssertTests {
@Test
void createWhenApplicationContextIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new ApplicationContextAssert<>(null, null))
.withMessageContaining("ApplicationContext must not be null");
.withMessageContaining("'applicationContext' 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.
@@ -70,7 +70,7 @@ class ContextConsumerTests {
ContextConsumer<?> consumer = (context) -> {
};
assertThatIllegalArgumentException().isThrownBy(() -> consumer.andThen(null))
.withMessage("After must not be null");
.withMessage("'after' must not be null");
}
}

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.
@@ -93,13 +93,13 @@ abstract class AbstractJsonMarshalTesterTests {
void createWhenResourceLoadClassIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> createTester(null, ResolvableType.forClass(ExampleObject.class)))
.withMessageContaining("ResourceLoadClass must not be null");
.withMessageContaining("'resourceLoadClass' must not be null");
}
@Test
void createWhenTypeIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> createTester(getClass(), 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.
@@ -45,7 +45,7 @@ class BasicJsonTesterTests {
@Test
void createWhenResourceLoadClassIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new BasicJsonTester(null))
.withMessageContaining("ResourceLoadClass must not be null");
.withMessageContaining("'resourceLoadClass' 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.
@@ -37,14 +37,14 @@ class GsonTesterTests extends AbstractJsonMarshalTesterTests {
@Test
void initFieldsWhenTestIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> GsonTester.initFields(null, new GsonBuilder().create()))
.withMessageContaining("TestInstance must not be null");
.withMessageContaining("'testInstance' must not be null");
}
@Test
void initFieldsWhenMarshallerIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> GsonTester.initFields(new InitFieldsTestClass(), (Gson) null))
.withMessageContaining("Marshaller must not be null");
.withMessageContaining("'marshaller' 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.
@@ -36,14 +36,14 @@ class JacksonTesterTests extends AbstractJsonMarshalTesterTests {
@Test
void initFieldsWhenTestIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> JacksonTester.initFields(null, new ObjectMapper()))
.withMessageContaining("TestInstance must not be null");
.withMessageContaining("'testInstance' must not be null");
}
@Test
void initFieldsWhenMarshallerIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> JacksonTester.initFields(new InitFieldsTestClass(), (ObjectMapper) null))
.withMessageContaining("Marshaller must not be null");
.withMessageContaining("'marshaller' 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.
@@ -39,7 +39,7 @@ class JsonContentTests {
void createWhenResourceLoadClassIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new JsonContent<ExampleObject>(null, TYPE, JSON, Configuration.defaultConfiguration()))
.withMessageContaining("ResourceLoadClass must not be null");
.withMessageContaining("'resourceLoadClass' must not be null");
}
@Test
@@ -47,14 +47,14 @@ class JsonContentTests {
assertThatIllegalArgumentException()
.isThrownBy(
() -> new JsonContent<ExampleObject>(getClass(), TYPE, null, Configuration.defaultConfiguration()))
.withMessageContaining("JSON must not be null");
.withMessageContaining("'json' must not be null");
}
@Test
void createWhenConfigurationIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new JsonContent<ExampleObject>(getClass(), TYPE, JSON, null))
.withMessageContaining("Configuration must not be null");
.withMessageContaining("'configuration' 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.
@@ -37,14 +37,14 @@ class JsonbTesterTests extends AbstractJsonMarshalTesterTests {
@Test
void initFieldsWhenTestIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> JsonbTester.initFields(null, JsonbBuilder.create()))
.withMessageContaining("TestInstance must not be null");
.withMessageContaining("'testInstance' must not be null");
}
@Test
void initFieldsWhenMarshallerIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> JsonbTester.initFields(new InitFieldsTestClass(), (Jsonb) null))
.withMessageContaining("Marshaller must not be null");
.withMessageContaining("'marshaller' 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.
@@ -37,7 +37,7 @@ class ObjectContentTests {
@Test
void createWhenObjectIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new ObjectContent<ExampleObject>(TYPE, null))
.withMessageContaining("Object must not be null");
.withMessageContaining("'object' 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.
@@ -45,7 +45,7 @@ class MockDefinitionTests {
void classToMockMustNotBeNull() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new MockDefinition(null, null, null, null, false, null, null))
.withMessageContaining("TypeToMock must not be null");
.withMessageContaining("'typeToMock' 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.
@@ -45,7 +45,7 @@ class SpyDefinitionTests {
@Test
void classToSpyMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() -> new SpyDefinition(null, null, null, true, null))
.withMessageContaining("TypeToSpy must not be null");
.withMessageContaining("'typeToSpy' must not be null");
}
@Test
@@ -84,7 +84,7 @@ class SpyDefinitionTests {
void createSpyWhenNullInstanceShouldThrowException() {
SpyDefinition definition = new SpyDefinition("name", REAL_SERVICE_TYPE, MockReset.BEFORE, true, null);
assertThatIllegalArgumentException().isThrownBy(() -> definition.createSpy(null))
.withMessageContaining("Instance must not be null");
.withMessageContaining("'instance' 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.
@@ -43,21 +43,21 @@ class LocalHostUriTemplateHandlerTests {
@Test
void createWhenEnvironmentIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new LocalHostUriTemplateHandler(null))
.withMessageContaining("Environment must not be null");
.withMessageContaining("'environment' must not be null");
}
@Test
void createWhenSchemeIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new LocalHostUriTemplateHandler(new MockEnvironment(), null))
.withMessageContaining("Scheme must not be null");
.withMessageContaining("'scheme' must not be null");
}
@Test
void createWhenHandlerIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new LocalHostUriTemplateHandler(new MockEnvironment(), "http", null))
.withMessageContaining("Handler must not be null");
.withMessageContaining("'handler' 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,7 +59,7 @@ class MockServerRestClientCustomizerTests {
void createWhenExpectationManagerClassIsNullShouldThrowException() {
Class<? extends RequestExpectationManager> expectationManager = null;
assertThatIllegalArgumentException().isThrownBy(() -> new MockServerRestClientCustomizer(expectationManager))
.withMessageContaining("ExpectationManager must not be null");
.withMessageContaining("'expectationManager' must not be null");
}
@Test
@@ -67,7 +67,7 @@ class MockServerRestClientCustomizerTests {
Supplier<? extends RequestExpectationManager> expectationManagerSupplier = null;
assertThatIllegalArgumentException()
.isThrownBy(() -> new MockServerRestClientCustomizer(expectationManagerSupplier))
.withMessageContaining("ExpectationManagerSupplier must not be null");
.withMessageContaining("'expectationManagerSupplier' 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.
@@ -62,7 +62,7 @@ class MockServerRestTemplateCustomizerTests {
void createWhenExpectationManagerClassIsNullShouldThrowException() {
Class<? extends RequestExpectationManager> expectationManager = null;
assertThatIllegalArgumentException().isThrownBy(() -> new MockServerRestTemplateCustomizer(expectationManager))
.withMessageContaining("ExpectationManager must not be null");
.withMessageContaining("'expectationManager' must not be null");
}
@Test
@@ -70,7 +70,7 @@ class MockServerRestTemplateCustomizerTests {
Supplier<? extends RequestExpectationManager> expectationManagerSupplier = null;
assertThatIllegalArgumentException()
.isThrownBy(() -> new MockServerRestTemplateCustomizer(expectationManagerSupplier))
.withMessageContaining("ExpectationManagerSupplier must not be null");
.withMessageContaining("'expectationManagerSupplier' 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,13 +67,13 @@ class RootUriRequestExpectationManagerTests {
@Test
void createWhenRootUriIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new RootUriRequestExpectationManager(null, this.delegate))
.withMessageContaining("RootUri must not be null");
.withMessageContaining("'rootUri' must not be null");
}
@Test
void createWhenExpectationManagerIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new RootUriRequestExpectationManager(this.uri, null))
.withMessageContaining("ExpectationManager must not be null");
.withMessageContaining("'expectationManager' 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.
@@ -49,7 +49,7 @@ class LocalHostWebClientTests {
@Test
void createWhenEnvironmentIsNullWillThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new LocalHostWebClient(null))
.withMessageContaining("Environment must not be null");
.withMessageContaining("'environment' 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.
@@ -64,20 +64,20 @@ class LocalHostWebConnectionHtmlUnitDriverTests {
@Test
void createWhenEnvironmentIsNullWillThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new LocalHostWebConnectionHtmlUnitDriver(null))
.withMessageContaining("Environment must not be null");
.withMessageContaining("'environment' must not be null");
}
@Test
void createWithJavascriptFlagWhenEnvironmentIsNullWillThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new LocalHostWebConnectionHtmlUnitDriver(null, true))
.withMessageContaining("Environment must not be null");
.withMessageContaining("'environment' must not be null");
}
@Test
void createWithBrowserVersionWhenEnvironmentIsNullWillThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new LocalHostWebConnectionHtmlUnitDriver(null, BrowserVersion.CHROME))
.withMessageContaining("Environment must not be null");
.withMessageContaining("'environment' must not be null");
}
@Test
@@ -87,7 +87,7 @@ class LocalHostWebConnectionHtmlUnitDriverTests {
given(capabilities.getBrowserVersion()).willReturn("chrome");
assertThatIllegalArgumentException()
.isThrownBy(() -> new LocalHostWebConnectionHtmlUnitDriver(null, capabilities))
.withMessageContaining("Environment must not be null");
.withMessageContaining("'environment' must not be null");
}
@Test