Polish assertions

This commit is contained in:
Stephane Nicoll
2022-06-21 07:57:11 +02:00
parent 93b340e563
commit 0f4205adbf
16 changed files with 61 additions and 61 deletions

View File

@@ -39,7 +39,7 @@ class AotFactoriesLoaderTests {
void createWhenBeanFactoryIsNullThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new AotFactoriesLoader(null))
.withMessage("BeanFactory must not be null");
.withMessage("'beanFactory' must not be null");
}
@Test
@@ -47,7 +47,7 @@ class AotFactoriesLoaderTests {
ListableBeanFactory beanFactory = new DefaultListableBeanFactory();
assertThatIllegalArgumentException()
.isThrownBy(() -> new AotFactoriesLoader(beanFactory, null))
.withMessage("FactoriesLoader must not be null");
.withMessage("'factoriesLoader' must not be null");
}
@Test

View File

@@ -45,7 +45,7 @@ class AutowiredFieldValueResolverTests {
@Test
void forFieldWhenFieldNameIsEmptyThrowsException() {
String message = "FieldName must not be empty";
String message = "'fieldName' must not be empty";
assertThatIllegalArgumentException()
.isThrownBy(() -> AutowiredFieldValueResolver.forField(null))
.withMessage(message);
@@ -64,7 +64,7 @@ class AutowiredFieldValueResolverTests {
void resolveWhenRegisteredBeanIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(
() -> AutowiredFieldValueResolver.forField("string").resolve(null))
.withMessage("RegisteredBean must not be null");
.withMessage("'registeredBean' must not be null");
}
@Test
@@ -122,7 +122,7 @@ class AutowiredFieldValueResolverTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> AutowiredFieldValueResolver.forField("string")
.resolveAndSet(registeredBean, null))
.withMessage("Instance must not be null");
.withMessage("'instance' must not be null");
}
@Test
@@ -141,7 +141,7 @@ class AutowiredFieldValueResolverTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> AutowiredFieldValueResolver.forField("string")
.resolve(registeredBean, (ThrowingConsumer<Object>) null))
.withMessage("Action must not be null");
.withMessage("'action' must not be null");
}
@Test

View File

@@ -76,7 +76,7 @@ class AutowiredInstantiationArgumentsResolverTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> AutowiredInstantiationArgumentsResolver
.forConstructor((Class<?>[]) null))
.withMessage("ParameterTypes must not be null");
.withMessage("'parameterTypes' must not be null");
}
@Test
@@ -84,7 +84,7 @@ class AutowiredInstantiationArgumentsResolverTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> AutowiredInstantiationArgumentsResolver
.forConstructor(String.class, null))
.withMessage("ParameterTypes must not contain null elements");
.withMessage("'parameterTypes' must not contain null elements");
}
@Test
@@ -104,7 +104,7 @@ class AutowiredInstantiationArgumentsResolverTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> AutowiredInstantiationArgumentsResolver
.forFactoryMethod(null, "test"))
.withMessage("DeclaringClass must not be null");
.withMessage("'declaringClass' must not be null");
}
@Test
@@ -112,7 +112,7 @@ class AutowiredInstantiationArgumentsResolverTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> AutowiredInstantiationArgumentsResolver
.forFactoryMethod(SingleArgFactory.class, ""))
.withMessage("MethodName must not be empty");
.withMessage("'methodName' must not be empty");
}
@Test
@@ -121,7 +121,7 @@ class AutowiredInstantiationArgumentsResolverTests {
.isThrownBy(
() -> AutowiredInstantiationArgumentsResolver.forFactoryMethod(
SingleArgFactory.class, "single", (Class<?>[]) null))
.withMessage("ParameterTypes must not be null");
.withMessage("'parameterTypes' must not be null");
}
@Test
@@ -130,7 +130,7 @@ class AutowiredInstantiationArgumentsResolverTests {
.isThrownBy(
() -> AutowiredInstantiationArgumentsResolver.forFactoryMethod(
SingleArgFactory.class, "single", String.class, null))
.withMessage("ParameterTypes must not contain null elements");
.withMessage("'parameterTypes' must not contain null elements");
}
@Test
@@ -153,7 +153,7 @@ class AutowiredInstantiationArgumentsResolverTests {
RegisteredBean registerBean = source.registerBean(this.beanFactory);
assertThatIllegalArgumentException()
.isThrownBy(() -> resolver.resolve(registerBean, null))
.withMessage("Action must not be null");
.withMessage("'action' must not be null");
}
@Test
@@ -174,7 +174,7 @@ class AutowiredInstantiationArgumentsResolverTests {
AutowiredInstantiationArgumentsResolver resolver = AutowiredInstantiationArgumentsResolver
.forConstructor(String.class);
assertThatIllegalArgumentException().isThrownBy(() -> resolver.resolve(null))
.withMessage("RegisteredBean must not be null");
.withMessage("'registeredBean' must not be null");
}
@ParameterizedResolverTest(Sources.SINGLE_ARG)

View File

@@ -47,7 +47,7 @@ class AutowiredMethodArgumentsResolverTests {
@Test
void forMethodWhenMethodNameIsEmptyThrowsException() {
String message = "MethodName must not be empty";
String message = "'methodName' must not be empty";
assertThatIllegalArgumentException()
.isThrownBy(() -> AutowiredMethodArgumentsResolver.forMethod(null))
.withMessage(message);
@@ -68,7 +68,7 @@ class AutowiredMethodArgumentsResolverTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> AutowiredMethodArgumentsResolver
.forMethod("injectString", String.class).resolve(null))
.withMessage("RegisteredBean must not be null");
.withMessage("'registeredBean' must not be null");
}
@Test
@@ -134,7 +134,7 @@ class AutowiredMethodArgumentsResolverTests {
.isThrownBy(() -> AutowiredMethodArgumentsResolver
.forMethod("injectString", String.class)
.resolveAndInvoke(registeredBean, null))
.withMessage("Instance must not be null");
.withMessage("'instance' must not be null");
}
@Test
@@ -155,7 +155,7 @@ class AutowiredMethodArgumentsResolverTests {
.isThrownBy(() -> AutowiredMethodArgumentsResolver
.forMethod("injectString", String.class)
.resolve(registeredBean, null))
.withMessage("Action must not be null");
.withMessage("'action' must not be null");
}
@Test

View File

@@ -51,14 +51,14 @@ class RegisteredBeanTests {
void ofWhenBeanFactoryIsNullThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> RegisteredBean.of(null, "bd"))
.withMessage("BeanFactory must not be null");
.withMessage("'beanFactory' must not be null");
}
@Test
void ofWhenBeanNameIsEmptyThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> RegisteredBean.of(this.beanFactory, null))
.withMessage("BeanName must not be empty");
.withMessage("'beanName' must not be empty");
}
@Test
@@ -66,7 +66,7 @@ class RegisteredBeanTests {
RegisteredBean parent = RegisteredBean.of(this.beanFactory, "bd");
assertThatIllegalArgumentException().isThrownBy(
() -> RegisteredBean.ofInnerBean(parent, (BeanDefinitionHolder) null))
.withMessage("InnerBean must not be null");
.withMessage("'innerBean' must not be null");
}
@Test
@@ -74,7 +74,7 @@ class RegisteredBeanTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> RegisteredBean.ofInnerBean(null,
new RootBeanDefinition(TestInnerBean.class)))
.withMessage("Parent must not be null");
.withMessage("'parent' must not be null");
}
@Test
@@ -82,7 +82,7 @@ class RegisteredBeanTests {
RegisteredBean parent = RegisteredBean.of(this.beanFactory, "bd");
assertThatIllegalArgumentException()
.isThrownBy(() -> RegisteredBean.ofInnerBean(parent, "ib", null))
.withMessage("InnerBeanDefinition must not be null");
.withMessage("'innerBeanDefinition' must not be null");
}
@Test