mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Convert assertThat(x instanceof X).isTrue() to assertThat(x).isInstanceOf()
Search: assertThat\((.+?) instanceof (.+?)\)(.*?)\.isTrue\(\) Replace: assertThat($1)$3.isInstanceOf($2.class) See gh-36504
This commit is contained in:
+2
-2
@@ -63,7 +63,7 @@ class AopNamespaceHandlerScopeIntegrationTests {
|
||||
@Test
|
||||
void singletonScoping() throws Exception {
|
||||
assertThat(AopUtils.isAopProxy(singletonScoped)).as("Should be AOP proxy").isTrue();
|
||||
assertThat(singletonScoped instanceof TestBean).as("Should be target class proxy").isTrue();
|
||||
assertThat(singletonScoped).as("Should be target class proxy").isInstanceOf(TestBean.class);
|
||||
String rob = "Rob Harrop";
|
||||
String bram = "Bram Smeets";
|
||||
assertThat(singletonScoped.getName()).isEqualTo(rob);
|
||||
@@ -81,7 +81,7 @@ class AopNamespaceHandlerScopeIntegrationTests {
|
||||
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(oldRequest));
|
||||
|
||||
assertThat(AopUtils.isAopProxy(requestScoped)).as("Should be AOP proxy").isTrue();
|
||||
assertThat(requestScoped instanceof TestBean).as("Should be target class proxy").isTrue();
|
||||
assertThat(requestScoped).as("Should be target class proxy").isInstanceOf(TestBean.class);
|
||||
|
||||
assertThat(AopUtils.isAopProxy(testBean)).as("Should be AOP proxy").isTrue();
|
||||
assertThat(testBean instanceof TestBean).as("Regular bean should be JDK proxy").isFalse();
|
||||
|
||||
+1
-1
@@ -168,7 +168,7 @@ class AdvisorAutoProxyCreatorIntegrationTests {
|
||||
BeanFactory bf = getBeanFactory();
|
||||
|
||||
Object bean = bf.getBean(TXMANAGER_BEAN_NAME);
|
||||
assertThat(bean instanceof CallCountingTransactionManager).isTrue();
|
||||
assertThat(bean).isInstanceOf(CallCountingTransactionManager.class);
|
||||
CallCountingTransactionManager txMan = (CallCountingTransactionManager) bf.getBean(TXMANAGER_BEAN_NAME);
|
||||
|
||||
Rollback rb = (Rollback) bf.getBean("rollback");
|
||||
|
||||
+5
-5
@@ -185,7 +185,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
|
||||
|
||||
// should be dynamic proxy, implementing both interfaces
|
||||
assertThat(AopUtils.isJdkDynamicProxy(bean)).isTrue();
|
||||
assertThat(bean instanceof AnotherScopeTestInterface).isTrue();
|
||||
assertThat(bean).isInstanceOf(AnotherScopeTestInterface.class);
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
@@ -206,7 +206,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
|
||||
|
||||
// should be a class-based proxy
|
||||
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
|
||||
assertThat(bean instanceof RequestScopedTestBean).isTrue();
|
||||
assertThat(bean).isInstanceOf(RequestScopedTestBean.class);
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
@@ -248,7 +248,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
|
||||
|
||||
// should be dynamic proxy, implementing both interfaces
|
||||
assertThat(AopUtils.isJdkDynamicProxy(bean)).isTrue();
|
||||
assertThat(bean instanceof AnotherScopeTestInterface).isTrue();
|
||||
assertThat(bean).isInstanceOf(AnotherScopeTestInterface.class);
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
@@ -275,8 +275,8 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
|
||||
|
||||
// should be a class-based proxy
|
||||
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
|
||||
assertThat(bean instanceof ScopedTestBean).isTrue();
|
||||
assertThat(bean instanceof SessionScopedTestBean).isTrue();
|
||||
assertThat(bean).isInstanceOf(ScopedTestBean.class);
|
||||
assertThat(bean).isInstanceOf(SessionScopedTestBean.class);
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
|
||||
+5
-5
@@ -166,7 +166,7 @@ class ClassPathBeanDefinitionScannerScopeIntegrationTests {
|
||||
|
||||
// should be dynamic proxy, implementing both interfaces
|
||||
assertThat(AopUtils.isJdkDynamicProxy(bean)).isTrue();
|
||||
assertThat(bean instanceof AnotherScopeTestInterface).isTrue();
|
||||
assertThat(bean).isInstanceOf(AnotherScopeTestInterface.class);
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
@@ -187,7 +187,7 @@ class ClassPathBeanDefinitionScannerScopeIntegrationTests {
|
||||
|
||||
// should be a class-based proxy
|
||||
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
|
||||
assertThat(bean instanceof RequestScopedTestBean).isTrue();
|
||||
assertThat(bean).isInstanceOf(RequestScopedTestBean.class);
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
@@ -229,7 +229,7 @@ class ClassPathBeanDefinitionScannerScopeIntegrationTests {
|
||||
|
||||
// should be dynamic proxy, implementing both interfaces
|
||||
assertThat(AopUtils.isJdkDynamicProxy(bean)).isTrue();
|
||||
assertThat(bean instanceof AnotherScopeTestInterface).isTrue();
|
||||
assertThat(bean).isInstanceOf(AnotherScopeTestInterface.class);
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
@@ -256,8 +256,8 @@ class ClassPathBeanDefinitionScannerScopeIntegrationTests {
|
||||
|
||||
// should be a class-based proxy
|
||||
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
|
||||
assertThat(bean instanceof ScopedTestBean).isTrue();
|
||||
assertThat(bean instanceof SessionScopedTestBean).isTrue();
|
||||
assertThat(bean).isInstanceOf(ScopedTestBean.class);
|
||||
assertThat(bean).isInstanceOf(SessionScopedTestBean.class);
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ class AspectJPointcutAdvisorTests {
|
||||
1, "someBean");
|
||||
|
||||
assertThat(ajpa.getAspectMetadata().getPerClausePointcut()).isNotSameAs(Pointcut.TRUE);
|
||||
assertThat(ajpa.getAspectMetadata().getPerClausePointcut() instanceof AspectJExpressionPointcut).isTrue();
|
||||
assertThat(ajpa.getAspectMetadata().getPerClausePointcut()).isInstanceOf(AspectJExpressionPointcut.class);
|
||||
assertThat(ajpa.isPerInstance()).isTrue();
|
||||
|
||||
assertThat(ajpa.getAspectMetadata().getPerClausePointcut().getClassFilter().matches(TestBean.class)).isTrue();
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ class ExposeBeanNameAdvisorsTests {
|
||||
pf.addAdvisor(ExposeBeanNameAdvisors.createAdvisorIntroducingNamedBean(beanName));
|
||||
ITestBean proxy = (ITestBean) pf.getProxy();
|
||||
|
||||
assertThat(proxy instanceof NamedBean).as("Introduction was made").isTrue();
|
||||
assertThat(proxy).as("Introduction was made").isInstanceOf(NamedBean.class);
|
||||
// Requires binding
|
||||
proxy.getAge();
|
||||
|
||||
|
||||
+1
-1
@@ -402,7 +402,7 @@ class XmlBeanCollectionTests {
|
||||
@Test
|
||||
void choiceBetweenSetAndMap() {
|
||||
MapAndSet sam = (MapAndSet) this.beanFactory.getBean("setAndMap");
|
||||
assertThat(sam.getObject() instanceof Map).as("Didn't choose constructor with Map argument").isTrue();
|
||||
assertThat(sam.getObject()).as("Didn't choose constructor with Map argument").isInstanceOf(Map.class);
|
||||
Map map = (Map) sam.getObject();
|
||||
assertThat(map).containsOnly(entry("key1", "val1"), entry("key2", "val2"), entry("key3", "val3"));
|
||||
}
|
||||
|
||||
+5
-5
@@ -42,7 +42,7 @@ class ResourceBundleEditorTests {
|
||||
editor.setAsText(BASE_NAME);
|
||||
Object value = editor.getValue();
|
||||
assertThat(value).as("Returned ResourceBundle was null (must not be for valid setAsText(..) call).").isNotNull();
|
||||
assertThat(value instanceof ResourceBundle).as("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).").isTrue();
|
||||
assertThat(value).as("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).").isInstanceOf(ResourceBundle.class);
|
||||
ResourceBundle bundle = (ResourceBundle) value;
|
||||
String string = bundle.getString(MESSAGE_KEY);
|
||||
assertThat(string).isEqualTo(MESSAGE_KEY);
|
||||
@@ -54,7 +54,7 @@ class ResourceBundleEditorTests {
|
||||
editor.setAsText(BASE_NAME + "_");
|
||||
Object value = editor.getValue();
|
||||
assertThat(value).as("Returned ResourceBundle was null (must not be for valid setAsText(..) call).").isNotNull();
|
||||
assertThat(value instanceof ResourceBundle).as("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).").isTrue();
|
||||
assertThat(value).as("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).").isInstanceOf(ResourceBundle.class);
|
||||
ResourceBundle bundle = (ResourceBundle) value;
|
||||
String string = bundle.getString(MESSAGE_KEY);
|
||||
assertThat(string).isEqualTo(MESSAGE_KEY);
|
||||
@@ -66,7 +66,7 @@ class ResourceBundleEditorTests {
|
||||
editor.setAsText(BASE_NAME + "Lang" + "_en");
|
||||
Object value = editor.getValue();
|
||||
assertThat(value).as("Returned ResourceBundle was null (must not be for valid setAsText(..) call).").isNotNull();
|
||||
assertThat(value instanceof ResourceBundle).as("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).").isTrue();
|
||||
assertThat(value).as("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).").isInstanceOf(ResourceBundle.class);
|
||||
ResourceBundle bundle = (ResourceBundle) value;
|
||||
String string = bundle.getString(MESSAGE_KEY);
|
||||
assertThat(string).isEqualTo("yob");
|
||||
@@ -78,7 +78,7 @@ class ResourceBundleEditorTests {
|
||||
editor.setAsText(BASE_NAME + "LangCountry" + "_en_GB");
|
||||
Object value = editor.getValue();
|
||||
assertThat(value).as("Returned ResourceBundle was null (must not be for valid setAsText(..) call).").isNotNull();
|
||||
assertThat(value instanceof ResourceBundle).as("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).").isTrue();
|
||||
assertThat(value).as("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).").isInstanceOf(ResourceBundle.class);
|
||||
ResourceBundle bundle = (ResourceBundle) value;
|
||||
String string = bundle.getString(MESSAGE_KEY);
|
||||
assertThat(string).isEqualTo("chav");
|
||||
@@ -90,7 +90,7 @@ class ResourceBundleEditorTests {
|
||||
editor.setAsText(BASE_NAME + "LangCountryDialect" + "_en_GB_GLASGOW");
|
||||
Object value = editor.getValue();
|
||||
assertThat(value).as("Returned ResourceBundle was null (must not be for valid setAsText(..) call).").isNotNull();
|
||||
assertThat(value instanceof ResourceBundle).as("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).").isTrue();
|
||||
assertThat(value).as("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).").isInstanceOf(ResourceBundle.class);
|
||||
ResourceBundle bundle = (ResourceBundle) value;
|
||||
String string = bundle.getString(MESSAGE_KEY);
|
||||
assertThat(string).isEqualTo("ned");
|
||||
|
||||
+2
-2
@@ -66,7 +66,7 @@ class BeanNamePointcutAtAspectTests {
|
||||
|
||||
@Test
|
||||
void matchingBeanName() {
|
||||
assertThat(testBean1 instanceof Advised).as("Expected a proxy").isTrue();
|
||||
assertThat(testBean1).as("Expected a proxy").isInstanceOf(Advised.class);
|
||||
|
||||
// Call two methods to test for SPR-3953-like condition
|
||||
testBean1.setAge(20);
|
||||
@@ -94,7 +94,7 @@ class BeanNamePointcutAtAspectTests {
|
||||
|
||||
ITestBean proxyTestBean = factory.getProxy();
|
||||
|
||||
assertThat(proxyTestBean instanceof Advised).as("Expected a proxy").isTrue();
|
||||
assertThat(proxyTestBean).as("Expected a proxy").isInstanceOf(Advised.class);
|
||||
proxyTestBean.setAge(20);
|
||||
assertThat(myCounterAspect.count).as("Programmatically created proxy shouldn't match bean()").isEqualTo(0);
|
||||
}
|
||||
|
||||
+4
-4
@@ -75,7 +75,7 @@ class BeanNamePointcutTests {
|
||||
|
||||
@Test
|
||||
void matchingBeanName() {
|
||||
assertThat(this.testBean1 instanceof Advised).as("Matching bean must be advised (proxied)").isTrue();
|
||||
assertThat(this.testBean1).as("Matching bean must be advised (proxied)").isInstanceOf(Advised.class);
|
||||
// Call two methods to test for SPR-3953-like condition
|
||||
this.testBean1.setAge(20);
|
||||
this.testBean1.setName("");
|
||||
@@ -96,7 +96,7 @@ class BeanNamePointcutTests {
|
||||
|
||||
@Test
|
||||
void matchingFactoryBeanObject() {
|
||||
assertThat(this.testFactoryBean1 instanceof Advised).as("Matching bean must be advised (proxied)").isTrue();
|
||||
assertThat(this.testFactoryBean1).as("Matching bean must be advised (proxied)").isInstanceOf(Advised.class);
|
||||
assertThat(this.testFactoryBean1.get("myKey")).isEqualTo("myValue");
|
||||
assertThat(this.testFactoryBean1.get("myKey")).isEqualTo("myValue");
|
||||
assertThat(this.counterAspect.getCount()).as("Advice not executed: must have been").isEqualTo(2);
|
||||
@@ -108,7 +108,7 @@ class BeanNamePointcutTests {
|
||||
void matchingFactoryBeanItself() {
|
||||
assertThat((this.testFactoryBean2 instanceof Advised)).as("Matching bean must *not* be advised (proxied)").isFalse();
|
||||
FactoryBean<?> fb = (FactoryBean<?>) ctx.getBean("&testFactoryBean2");
|
||||
assertThat(fb instanceof Advised).as("FactoryBean itself must be advised").isTrue();
|
||||
assertThat(fb).as("FactoryBean itself must be advised").isInstanceOf(Advised.class);
|
||||
assertThat(Map.class.isAssignableFrom(fb.getObjectType())).isTrue();
|
||||
assertThat(Map.class.isAssignableFrom(fb.getObjectType())).isTrue();
|
||||
assertThat(this.counterAspect.getCount()).as("Advice not executed: must have been").isEqualTo(2);
|
||||
@@ -116,7 +116,7 @@ class BeanNamePointcutTests {
|
||||
|
||||
@Test
|
||||
void pointcutAdvisorCombination() {
|
||||
assertThat(this.interceptThis instanceof Advised).as("Matching bean must be advised (proxied)").isTrue();
|
||||
assertThat(this.interceptThis).as("Matching bean must be advised (proxied)").isInstanceOf(Advised.class);
|
||||
assertThat(this.dontInterceptThis instanceof Advised).as("Non-matching bean must *not* be advised (proxied)").isFalse();
|
||||
interceptThis.setAge(20);
|
||||
assertThat(testInterceptor.interceptionCount).isEqualTo(1);
|
||||
|
||||
+2
-2
@@ -61,7 +61,7 @@ class PropertyDependentAspectTests {
|
||||
private void checkXmlAspect(String appContextFile) {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(appContextFile, getClass());
|
||||
ICounter counter = (ICounter) context.getBean("counter");
|
||||
assertThat(counter instanceof Advised).as("Proxy didn't get created").isTrue();
|
||||
assertThat(counter).as("Proxy didn't get created").isInstanceOf(Advised.class);
|
||||
|
||||
counter.increment();
|
||||
JoinPointMonitorAspect callCountingAspect = (JoinPointMonitorAspect)context.getBean("monitoringAspect");
|
||||
@@ -72,7 +72,7 @@ class PropertyDependentAspectTests {
|
||||
private void checkAtAspectJAspect(String appContextFile) {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(appContextFile, getClass());
|
||||
ICounter counter = (ICounter) context.getBean("counter");
|
||||
assertThat(counter instanceof Advised).as("Proxy didn't get created").isTrue();
|
||||
assertThat(counter).as("Proxy didn't get created").isInstanceOf(Advised.class);
|
||||
|
||||
counter.increment();
|
||||
JoinPointMonitorAtAspectJAspect callCountingAspect = (JoinPointMonitorAtAspectJAspect)context.getBean("monitoringAspect");
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ class MethodLocatingFactoryBeanTests {
|
||||
factory.setBeanFactory(beanFactory);
|
||||
Object result = factory.getObject();
|
||||
assertThat(result).isNotNull();
|
||||
assertThat(result instanceof Method).isTrue();
|
||||
assertThat(result).isInstanceOf(Method.class);
|
||||
Method method = (Method) result;
|
||||
assertThat(method.invoke("Bingo")).isEqualTo("Bingo");
|
||||
}
|
||||
|
||||
+4
-4
@@ -121,11 +121,11 @@ class CommonsPool2TargetSourceTests {
|
||||
void proxySerializableWithoutConfigMixin() throws Exception {
|
||||
Person pooled = (Person) beanFactory.getBean("pooledPerson");
|
||||
|
||||
assertThat(((Advised) pooled).getTargetSource() instanceof CommonsPool2TargetSource).isTrue();
|
||||
assertThat(((Advised) pooled).getTargetSource()).isInstanceOf(CommonsPool2TargetSource.class);
|
||||
|
||||
//((Advised) pooled).setTargetSource(new SingletonTargetSource(new SerializablePerson()));
|
||||
Person serialized = SerializationTestUtils.serializeAndDeserialize(pooled);
|
||||
assertThat(((Advised) serialized).getTargetSource() instanceof SingletonTargetSource).isTrue();
|
||||
assertThat(((Advised) serialized).getTargetSource()).isInstanceOf(SingletonTargetSource.class);
|
||||
serialized.setAge(25);
|
||||
assertThat(serialized.getAge()).isEqualTo(25);
|
||||
}
|
||||
@@ -204,8 +204,8 @@ class CommonsPool2TargetSourceTests {
|
||||
|
||||
Object first = targetSource.getTarget();
|
||||
Object second = targetSource.getTarget();
|
||||
assertThat(first instanceof SerializablePerson).isTrue();
|
||||
assertThat(second instanceof SerializablePerson).isTrue();
|
||||
assertThat(first).isInstanceOf(SerializablePerson.class);
|
||||
assertThat(second).isInstanceOf(SerializablePerson.class);
|
||||
assertThat(second).isEqualTo(first);
|
||||
|
||||
targetSource.releaseTarget(first);
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ class ClassPathFactoryBeanDefinitionScannerTests {
|
||||
|
||||
Object bean = context.getBean("requestScopedInstance"); //5
|
||||
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
|
||||
assertThat(bean instanceof ScopedObject).isTrue();
|
||||
assertThat(bean).isInstanceOf(ScopedObject.class);
|
||||
|
||||
QualifiedClientBean clientBean = context.getBean("clientBean", QualifiedClientBean.class);
|
||||
assertThat(clientBean.testBean).isSameAs(context.getBean("publicInstance"));
|
||||
|
||||
+1
-1
@@ -401,7 +401,7 @@ class CommonAnnotationBeanPostProcessorTests {
|
||||
bf.getBean("annotatedBean2");
|
||||
}
|
||||
catch (BeanCreationException ex) {
|
||||
assertThat(ex.getRootCause() instanceof NoSuchBeanDefinitionException).isTrue();
|
||||
assertThat(ex.getRootCause()).isInstanceOf(NoSuchBeanDefinitionException.class);
|
||||
NoSuchBeanDefinitionException innerEx = (NoSuchBeanDefinitionException) ex.getRootCause();
|
||||
assertThat(innerEx.getBeanName()).isEqualTo("testBean9");
|
||||
}
|
||||
|
||||
+5
-5
@@ -457,7 +457,7 @@ class ConfigurationClassPostProcessorTests {
|
||||
pp.postProcessBeanFactory(beanFactory);
|
||||
|
||||
Foo foo = beanFactory.getBean(Foo.class);
|
||||
assertThat(foo instanceof ExtendedFoo).isTrue();
|
||||
assertThat(foo).isInstanceOf(ExtendedFoo.class);
|
||||
Bar bar = beanFactory.getBean(Bar.class);
|
||||
assertThat(bar.foo).isSameAs(foo);
|
||||
}
|
||||
@@ -472,7 +472,7 @@ class ConfigurationClassPostProcessorTests {
|
||||
pp.postProcessBeanFactory(beanFactory);
|
||||
|
||||
Foo foo = beanFactory.getBean(Foo.class);
|
||||
assertThat(foo instanceof ExtendedAgainFoo).isTrue();
|
||||
assertThat(foo).isInstanceOf(ExtendedAgainFoo.class);
|
||||
Bar bar = beanFactory.getBean(Bar.class);
|
||||
assertThat(bar.foo).isSameAs(foo);
|
||||
}
|
||||
@@ -502,7 +502,7 @@ class ConfigurationClassPostProcessorTests {
|
||||
pp.postProcessBeanFactory(beanFactory);
|
||||
|
||||
Foo foo = beanFactory.getBean(Foo.class);
|
||||
assertThat(foo instanceof ExtendedFoo).isTrue();
|
||||
assertThat(foo).isInstanceOf(ExtendedFoo.class);
|
||||
Bar bar = beanFactory.getBean(Bar.class);
|
||||
assertThat(bar.foo).isSameAs(foo);
|
||||
}
|
||||
@@ -516,7 +516,7 @@ class ConfigurationClassPostProcessorTests {
|
||||
beanFactory.addBeanPostProcessor(new AutowiredAnnotationBeanPostProcessor());
|
||||
|
||||
Foo foo = beanFactory.getBean(Foo.class);
|
||||
assertThat(foo instanceof ExtendedFoo).isTrue();
|
||||
assertThat(foo).isInstanceOf(ExtendedFoo.class);
|
||||
Bar bar = beanFactory.getBean(Bar.class);
|
||||
assertThat(bar.foo).isSameAs(foo);
|
||||
}
|
||||
@@ -532,7 +532,7 @@ class ConfigurationClassPostProcessorTests {
|
||||
pp.postProcessBeanFactory(beanFactory);
|
||||
|
||||
ITestBean injected = beanFactory.getBean("consumer", ScopedProxyConsumer.class).testBean;
|
||||
assertThat(injected instanceof ScopedObject).isTrue();
|
||||
assertThat(injected).isInstanceOf(ScopedObject.class);
|
||||
assertThat(injected).isSameAs(beanFactory.getBean("scopedClass"));
|
||||
assertThat(injected).isSameAs(beanFactory.getBean(ITestBean.class));
|
||||
}
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ class LazyAutowiredAnnotationBeanPostProcessorTests {
|
||||
tb.setName("tb");
|
||||
assertThat(bean.getTestBean().getName()).isSameAs("tb");
|
||||
|
||||
assertThat(bean.getTestBeans() instanceof Advised).isTrue();
|
||||
assertThat(bean.getTestBeans()).isInstanceOf(Advised.class);
|
||||
TargetSource targetSource = ((Advised) bean.getTestBeans()).getTargetSource();
|
||||
assertThat(targetSource.getTarget()).isSameAs(targetSource.getTarget());
|
||||
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ class SimpleConfigTests {
|
||||
assertThat(value).isEqualTo("bar");
|
||||
|
||||
Future<?> future = fooService.asyncFoo(1);
|
||||
assertThat(future instanceof FutureTask).isTrue();
|
||||
assertThat(future).isInstanceOf(FutureTask.class);
|
||||
assertThat(future.get()).isEqualTo("bar");
|
||||
|
||||
assertThat(serviceInvocationCounter.getCount()).isEqualTo(2);
|
||||
|
||||
+2
-2
@@ -160,7 +160,7 @@ class ScopingTests {
|
||||
void scopedProxyConfiguration() {
|
||||
TestBean singleton = (TestBean) ctx.getBean("singletonWithScopedInterfaceDep");
|
||||
ITestBean spouse = singleton.getSpouse();
|
||||
assertThat(spouse instanceof ScopedObject).as("scoped bean is not wrapped by the scoped-proxy").isTrue();
|
||||
assertThat(spouse).as("scoped bean is not wrapped by the scoped-proxy").isInstanceOf(ScopedObject.class);
|
||||
|
||||
String beanName = "scopedProxyInterface";
|
||||
|
||||
@@ -192,7 +192,7 @@ class ScopingTests {
|
||||
void scopedProxyConfigurationWithClasses() {
|
||||
TestBean singleton = (TestBean) ctx.getBean("singletonWithScopedClassDep");
|
||||
ITestBean spouse = singleton.getSpouse();
|
||||
assertThat(spouse instanceof ScopedObject).as("scoped bean is not wrapped by the scoped-proxy").isTrue();
|
||||
assertThat(spouse).as("scoped bean is not wrapped by the scoped-proxy").isInstanceOf(ScopedObject.class);
|
||||
|
||||
String beanName = "scopedProxyClass";
|
||||
|
||||
|
||||
+6
-6
@@ -92,14 +92,14 @@ class LocaleContextHolderTests {
|
||||
LocaleContextHolder.setTimeZone(TimeZone.getTimeZone("GMT+1"));
|
||||
assertThat(LocaleContextHolder.getLocale()).isEqualTo(Locale.getDefault());
|
||||
assertThat(LocaleContextHolder.getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+1"));
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext()).isInstanceOf(TimeZoneAwareLocaleContext.class);
|
||||
assertThat(LocaleContextHolder.getLocaleContext().getLocale()).isNull();
|
||||
assertThat(((TimeZoneAwareLocaleContext) LocaleContextHolder.getLocaleContext()).getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+1"));
|
||||
|
||||
LocaleContextHolder.setTimeZone(TimeZone.getTimeZone("GMT+2"));
|
||||
assertThat(LocaleContextHolder.getLocale()).isEqualTo(Locale.getDefault());
|
||||
assertThat(LocaleContextHolder.getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+2"));
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext()).isInstanceOf(TimeZoneAwareLocaleContext.class);
|
||||
assertThat(LocaleContextHolder.getLocaleContext().getLocale()).isNull();
|
||||
assertThat(((TimeZoneAwareLocaleContext) LocaleContextHolder.getLocaleContext()).getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+2"));
|
||||
|
||||
@@ -125,14 +125,14 @@ class LocaleContextHolderTests {
|
||||
LocaleContextHolder.setTimeZone(TimeZone.getTimeZone("GMT+1"));
|
||||
assertThat(LocaleContextHolder.getLocale()).isEqualTo(Locale.GERMANY);
|
||||
assertThat(LocaleContextHolder.getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+1"));
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext()).isInstanceOf(TimeZoneAwareLocaleContext.class);
|
||||
assertThat(LocaleContextHolder.getLocaleContext().getLocale()).isEqualTo(Locale.GERMANY);
|
||||
assertThat(((TimeZoneAwareLocaleContext) LocaleContextHolder.getLocaleContext()).getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+1"));
|
||||
|
||||
LocaleContextHolder.setLocale(Locale.GERMAN);
|
||||
assertThat(LocaleContextHolder.getLocale()).isEqualTo(Locale.GERMAN);
|
||||
assertThat(LocaleContextHolder.getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+1"));
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext()).isInstanceOf(TimeZoneAwareLocaleContext.class);
|
||||
assertThat(LocaleContextHolder.getLocaleContext().getLocale()).isEqualTo(Locale.GERMAN);
|
||||
assertThat(((TimeZoneAwareLocaleContext) LocaleContextHolder.getLocaleContext()).getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+1"));
|
||||
|
||||
@@ -145,14 +145,14 @@ class LocaleContextHolderTests {
|
||||
LocaleContextHolder.setTimeZone(TimeZone.getTimeZone("GMT+2"));
|
||||
assertThat(LocaleContextHolder.getLocale()).isEqualTo(Locale.GERMAN);
|
||||
assertThat(LocaleContextHolder.getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+2"));
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext()).isInstanceOf(TimeZoneAwareLocaleContext.class);
|
||||
assertThat(LocaleContextHolder.getLocaleContext().getLocale()).isEqualTo(Locale.GERMAN);
|
||||
assertThat(((TimeZoneAwareLocaleContext) LocaleContextHolder.getLocaleContext()).getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+2"));
|
||||
|
||||
LocaleContextHolder.setLocale(null);
|
||||
assertThat(LocaleContextHolder.getLocale()).isEqualTo(Locale.getDefault());
|
||||
assertThat(LocaleContextHolder.getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+2"));
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext()).isInstanceOf(TimeZoneAwareLocaleContext.class);
|
||||
assertThat(LocaleContextHolder.getLocaleContext().getLocale()).isNull();
|
||||
assertThat(((TimeZoneAwareLocaleContext) LocaleContextHolder.getLocaleContext()).getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+2"));
|
||||
|
||||
|
||||
+3
-3
@@ -53,19 +53,19 @@ class JeeNamespaceHandlerEventTests {
|
||||
@Test
|
||||
void jndiLookupComponentEventReceived() {
|
||||
ComponentDefinition component = this.eventListener.getComponentDefinition("simple");
|
||||
assertThat(component instanceof BeanComponentDefinition).isTrue();
|
||||
assertThat(component).isInstanceOf(BeanComponentDefinition.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void localSlsbComponentEventReceived() {
|
||||
ComponentDefinition component = this.eventListener.getComponentDefinition("simpleLocalEjb");
|
||||
assertThat(component instanceof BeanComponentDefinition).isTrue();
|
||||
assertThat(component).isInstanceOf(BeanComponentDefinition.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void remoteSlsbComponentEventReceived() {
|
||||
ComponentDefinition component = this.eventListener.getComponentDefinition("simpleRemoteEjb");
|
||||
assertThat(component instanceof BeanComponentDefinition).isTrue();
|
||||
assertThat(component).isInstanceOf(BeanComponentDefinition.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -86,7 +86,7 @@ class ModelMBeanNotificationPublisherTests {
|
||||
publisher.sendNotification(notification);
|
||||
|
||||
assertThat(mbean.getActualNotification()).isNotNull();
|
||||
assertThat(mbean.getActualNotification() instanceof AttributeChangeNotification).isTrue();
|
||||
assertThat(mbean.getActualNotification()).isInstanceOf(AttributeChangeNotification.class);
|
||||
assertThat(mbean.getActualNotification()).as("The exact same Notification is not being passed through from the publisher to the mbean.").isSameAs(notification);
|
||||
assertThat(mbean.getActualNotification().getSource()).as("The 'source' property of the Notification is not being set to the ObjectName of the associated MBean.").isSameAs(objectName);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ class ModelMBeanNotificationPublisherTests {
|
||||
publisher.sendNotification(notification);
|
||||
|
||||
assertThat(mbean.getActualNotification()).isNotNull();
|
||||
assertThat(mbean.getActualNotification() instanceof AttributeChangeNotification).isTrue();
|
||||
assertThat(mbean.getActualNotification()).isInstanceOf(AttributeChangeNotification.class);
|
||||
assertThat(mbean.getActualNotification()).as("The exact same Notification is not being passed through from the publisher to the mbean.").isSameAs(notification);
|
||||
assertThat(mbean.getActualNotification().getSource()).as("The 'source' property of the Notification is *wrongly* being set to the ObjectName of the associated MBean.").isSameAs(this);
|
||||
}
|
||||
|
||||
+6
-6
@@ -210,7 +210,7 @@ class JndiObjectFactoryBeanTests {
|
||||
jof.setJndiName("foo");
|
||||
jof.setProxyInterface(ITestBean.class);
|
||||
jof.afterPropertiesSet();
|
||||
assertThat(jof.getObject() instanceof ITestBean).isTrue();
|
||||
assertThat(jof.getObject()).isInstanceOf(ITestBean.class);
|
||||
ITestBean proxy = (ITestBean) jof.getObject();
|
||||
assertThat(tb.getAge()).isEqualTo(0);
|
||||
proxy.setAge(99);
|
||||
@@ -246,7 +246,7 @@ class JndiObjectFactoryBeanTests {
|
||||
jof.setProxyInterface(ITestBean.class);
|
||||
jof.setLookupOnStartup(false);
|
||||
jof.afterPropertiesSet();
|
||||
assertThat(jof.getObject() instanceof ITestBean).isTrue();
|
||||
assertThat(jof.getObject()).isInstanceOf(ITestBean.class);
|
||||
ITestBean proxy = (ITestBean) jof.getObject();
|
||||
assertThat(tb.getName()).isNull();
|
||||
assertThat(tb.getAge()).isEqualTo(0);
|
||||
@@ -274,7 +274,7 @@ class JndiObjectFactoryBeanTests {
|
||||
jof.setProxyInterface(ITestBean.class);
|
||||
jof.setCache(false);
|
||||
jof.afterPropertiesSet();
|
||||
assertThat(jof.getObject() instanceof ITestBean).isTrue();
|
||||
assertThat(jof.getObject()).isInstanceOf(ITestBean.class);
|
||||
ITestBean proxy = (ITestBean) jof.getObject();
|
||||
assertThat(tb.getName()).isEqualTo("tb");
|
||||
assertThat(tb.getAge()).isEqualTo(1);
|
||||
@@ -304,7 +304,7 @@ class JndiObjectFactoryBeanTests {
|
||||
jof.setLookupOnStartup(false);
|
||||
jof.setCache(false);
|
||||
jof.afterPropertiesSet();
|
||||
assertThat(jof.getObject() instanceof ITestBean).isTrue();
|
||||
assertThat(jof.getObject()).isInstanceOf(ITestBean.class);
|
||||
ITestBean proxy = (ITestBean) jof.getObject();
|
||||
assertThat(tb.getName()).isNull();
|
||||
assertThat(tb.getAge()).isEqualTo(0);
|
||||
@@ -343,7 +343,7 @@ class JndiObjectFactoryBeanTests {
|
||||
jof.setExpectedType(TestBean.class);
|
||||
jof.setProxyInterface(ITestBean.class);
|
||||
jof.afterPropertiesSet();
|
||||
assertThat(jof.getObject() instanceof ITestBean).isTrue();
|
||||
assertThat(jof.getObject()).isInstanceOf(ITestBean.class);
|
||||
ITestBean proxy = (ITestBean) jof.getObject();
|
||||
assertThat(tb.getAge()).isEqualTo(0);
|
||||
proxy.setAge(99);
|
||||
@@ -379,7 +379,7 @@ class JndiObjectFactoryBeanTests {
|
||||
jof.setProxyInterface(ITestBean.class);
|
||||
jof.setExposeAccessContext(true);
|
||||
jof.afterPropertiesSet();
|
||||
assertThat(jof.getObject() instanceof ITestBean).isTrue();
|
||||
assertThat(jof.getObject()).isInstanceOf(ITestBean.class);
|
||||
ITestBean proxy = (ITestBean) jof.getObject();
|
||||
assertThat(tb.getAge()).isEqualTo(0);
|
||||
proxy.setAge(99);
|
||||
|
||||
+1
-1
@@ -331,7 +331,7 @@ class ScheduledAnnotationBeanPostProcessorTests {
|
||||
assertThat(task.getExpression()).isEqualTo("0 0 0-4,6-23 * * ?");
|
||||
Trigger trigger = task.getTrigger();
|
||||
assertThat(trigger).isNotNull();
|
||||
assertThat(trigger instanceof CronTrigger).isTrue();
|
||||
assertThat(trigger).isInstanceOf(CronTrigger.class);
|
||||
CronTrigger cronTrigger = (CronTrigger) trigger;
|
||||
ZonedDateTime dateTime = ZonedDateTime.of(2013, 4, 15, 4, 0, 0, 0, ZoneId.of("GMT+10"));
|
||||
Instant lastScheduledExecution = dateTime.toInstant();
|
||||
|
||||
+7
-7
@@ -223,7 +223,7 @@ class GroovyScriptFactoryTests {
|
||||
Messenger messenger = (Messenger) ctx.getBean("messenger");
|
||||
|
||||
assertThat(AopUtils.isAopProxy(messenger)).as("Should be a proxy for refreshable scripts").isTrue();
|
||||
assertThat(messenger instanceof Refreshable).as("Should be an instance of Refreshable").isTrue();
|
||||
assertThat(messenger).as("Should be an instance of Refreshable").isInstanceOf(Refreshable.class);
|
||||
|
||||
String desiredMessage = "Hello World!";
|
||||
assertThat(messenger.getMessage()).as("Message is incorrect").isEqualTo(desiredMessage);
|
||||
@@ -242,7 +242,7 @@ class GroovyScriptFactoryTests {
|
||||
ConfigurableMessenger messenger2 = (ConfigurableMessenger) ctx.getBean("messengerPrototype");
|
||||
|
||||
assertThat(AopUtils.isAopProxy(messenger)).as("Should be a proxy for refreshable scripts").isTrue();
|
||||
assertThat(messenger instanceof Refreshable).as("Should be an instance of Refreshable").isTrue();
|
||||
assertThat(messenger).as("Should be an instance of Refreshable").isInstanceOf(Refreshable.class);
|
||||
|
||||
assertThat(messenger.getMessage()).isEqualTo("Hello World!");
|
||||
assertThat(messenger2.getMessage()).isEqualTo("Hello World!");
|
||||
@@ -399,7 +399,7 @@ class GroovyScriptFactoryTests {
|
||||
CallCounter countingAspect = (CallCounter) ctx.getBean("getMessageAspect");
|
||||
|
||||
assertThat(AopUtils.isAopProxy(messenger)).isTrue();
|
||||
assertThat(messenger instanceof Refreshable).isTrue();
|
||||
assertThat(messenger).isInstanceOf(Refreshable.class);
|
||||
assertThat(countingAspect.getCalls()).isEqualTo(0);
|
||||
assertThat(messenger.getMessage()).isEqualTo("Hello World!");
|
||||
assertThat(countingAspect.getCalls()).isEqualTo(1);
|
||||
@@ -416,7 +416,7 @@ class GroovyScriptFactoryTests {
|
||||
Messenger messenger = (Messenger) ctx.getBean("refreshableMessenger");
|
||||
|
||||
assertThat(AopUtils.isAopProxy(messenger)).isTrue();
|
||||
assertThat(messenger instanceof Refreshable).isTrue();
|
||||
assertThat(messenger).isInstanceOf(Refreshable.class);
|
||||
assertThat(messenger.getMessage()).isEqualTo("Hello World!");
|
||||
|
||||
assertThat(ctx.getBeansOfType(ConcreteMessenger.class)).containsValue((ConcreteMessenger) messenger);
|
||||
@@ -467,7 +467,7 @@ class GroovyScriptFactoryTests {
|
||||
assertThat(Arrays.asList(ctx.getBeanNamesForType(Messenger.class))).contains("refreshableMessenger");
|
||||
Messenger messenger = (Messenger) ctx.getBean("refreshableMessenger");
|
||||
assertThat(AopUtils.isAopProxy(messenger)).isTrue();
|
||||
assertThat(messenger instanceof Refreshable).isTrue();
|
||||
assertThat(messenger).isInstanceOf(Refreshable.class);
|
||||
assertThat(messenger.getMessage()).isEqualTo("Hello World!");
|
||||
}
|
||||
|
||||
@@ -530,7 +530,7 @@ class GroovyScriptFactoryTests {
|
||||
void factoryBean() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext("groovyContext.xml", getClass());
|
||||
Object factory = context.getBean("&factory");
|
||||
assertThat(factory instanceof FactoryBean).isTrue();
|
||||
assertThat(factory).isInstanceOf(FactoryBean.class);
|
||||
Object result = context.getBean("factory");
|
||||
assertThat(result).isEqualTo("test");
|
||||
}
|
||||
@@ -539,7 +539,7 @@ class GroovyScriptFactoryTests {
|
||||
void refreshableFactoryBean() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext("groovyContext.xml", getClass());
|
||||
Object factory = context.getBean("&refreshableFactory");
|
||||
assertThat(factory instanceof FactoryBean).isTrue();
|
||||
assertThat(factory).isInstanceOf(FactoryBean.class);
|
||||
Object result = context.getBean("refreshableFactory");
|
||||
assertThat(result).isEqualTo("test");
|
||||
}
|
||||
|
||||
+6
-5
@@ -40,6 +40,7 @@ import org.springframework.core.io.Resource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.InstanceOfAssertFactories.LIST;
|
||||
|
||||
/**
|
||||
* @author Keith Donald
|
||||
@@ -181,11 +182,11 @@ class CollectionToCollectionConverterTests {
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private void testCollectionConversionToArrayList(Collection<String> aSource) {
|
||||
Object myConverted = (new CollectionToCollectionConverter(new GenericConversionService())).convert(
|
||||
aSource, TypeDescriptor.forObject(aSource), TypeDescriptor.forObject(new ArrayList()));
|
||||
assertThat(myConverted instanceof ArrayList<?>).isTrue();
|
||||
assertThat(((ArrayList<?>) myConverted)).hasSameSizeAs(aSource);
|
||||
private void testCollectionConversionToArrayList(Collection<String> source) {
|
||||
CollectionToCollectionConverter converter = new CollectionToCollectionConverter(new GenericConversionService());
|
||||
Object convertedValue = converter.convert(
|
||||
source, TypeDescriptor.forObject(source), TypeDescriptor.forObject(new ArrayList()));
|
||||
assertThat(convertedValue).asInstanceOf(LIST).hasSameSizeAs(source);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -57,7 +57,7 @@ class AutoPopulatingListTests {
|
||||
for (int x = 0; x < 10; x++) {
|
||||
Object element = list.get(x);
|
||||
assertThat(list.get(x)).as("Element is null").isNotNull();
|
||||
assertThat(element instanceof TestObject).as("Element is incorrect type").isTrue();
|
||||
assertThat(element).as("Element is incorrect type").isInstanceOf(TestObject.class);
|
||||
assertThat(element).isNotSameAs(lastElement);
|
||||
lastElement = element;
|
||||
}
|
||||
@@ -67,10 +67,10 @@ class AutoPopulatingListTests {
|
||||
list.add(11, helloWorld);
|
||||
assertThat(list).element(11, InstanceOfAssertFactories.STRING).isEqualTo(helloWorld);
|
||||
|
||||
assertThat(list.get(10) instanceof TestObject).isTrue();
|
||||
assertThat(list.get(12) instanceof TestObject).isTrue();
|
||||
assertThat(list.get(13) instanceof TestObject).isTrue();
|
||||
assertThat(list.get(20) instanceof TestObject).isTrue();
|
||||
assertThat(list.get(10)).isInstanceOf(TestObject.class);
|
||||
assertThat(list.get(12)).isInstanceOf(TestObject.class);
|
||||
assertThat(list.get(13)).isInstanceOf(TestObject.class);
|
||||
assertThat(list.get(20)).isInstanceOf(TestObject.class);
|
||||
}
|
||||
|
||||
private void doTestWithElementFactory(AutoPopulatingList<Object> list) {
|
||||
|
||||
+4
-4
@@ -104,10 +104,10 @@ class TableMetaDataContextTests {
|
||||
List<Object> values = context.matchInParameterValuesWithInsertColumns(map);
|
||||
|
||||
assertThat(values.size()).as("wrong number of parameters: ").isEqualTo(4);
|
||||
assertThat(values.get(0) instanceof Number).as("id not wrapped with type info").isTrue();
|
||||
assertThat(values.get(1) instanceof String).as("name not wrapped with type info").isTrue();
|
||||
assertThat(values.get(2) instanceof SqlParameterValue).as("date wrapped with type info").isTrue();
|
||||
assertThat(values.get(3) instanceof SqlParameterValue).as("version wrapped with type info").isTrue();
|
||||
assertThat(values.get(0)).as("id not wrapped with type info").isInstanceOf(Number.class);
|
||||
assertThat(values.get(1)).as("name not wrapped with type info").isInstanceOf(String.class);
|
||||
assertThat(values.get(2)).as("date wrapped with type info").isInstanceOf(SqlParameterValue.class);
|
||||
assertThat(values.get(3)).as("version wrapped with type info").isInstanceOf(SqlParameterValue.class);
|
||||
verify(metaDataResultSet, atLeastOnce()).next();
|
||||
verify(columnsResultSet, atLeastOnce()).next();
|
||||
verify(metaDataResultSet).close();
|
||||
|
||||
+2
-2
@@ -107,7 +107,7 @@ class JmsListenerAnnotationBeanPostProcessorTests {
|
||||
assertThat(endpoint.getClass()).as("Wrong endpoint type").isEqualTo(MethodJmsListenerEndpoint.class);
|
||||
MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
|
||||
assertThat(AopUtils.isJdkDynamicProxy(methodEndpoint.getBean())).isTrue();
|
||||
assertThat(methodEndpoint.getBean() instanceof SimpleService).isTrue();
|
||||
assertThat(methodEndpoint.getBean()).isInstanceOf(SimpleService.class);
|
||||
assertThat(methodEndpoint.getMethod()).isEqualTo(SimpleService.class.getMethod("handleIt", String.class, String.class));
|
||||
assertThat(methodEndpoint.getMostSpecificMethod()).isEqualTo(InterfaceProxyTestBean.class.getMethod("handleIt", String.class, String.class));
|
||||
|
||||
@@ -128,7 +128,7 @@ class JmsListenerAnnotationBeanPostProcessorTests {
|
||||
assertThat(endpoint.getClass()).as("Wrong endpoint type").isEqualTo(MethodJmsListenerEndpoint.class);
|
||||
MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
|
||||
assertThat(AopUtils.isCglibProxy(methodEndpoint.getBean())).isTrue();
|
||||
assertThat(methodEndpoint.getBean() instanceof ClassProxyTestBean).isTrue();
|
||||
assertThat(methodEndpoint.getBean()).isInstanceOf(ClassProxyTestBean.class);
|
||||
assertThat(methodEndpoint.getMethod()).isEqualTo(ClassProxyTestBean.class.getMethod("handleIt", String.class, String.class));
|
||||
assertThat(methodEndpoint.getMostSpecificMethod()).isEqualTo(ClassProxyTestBean.class.getMethod("handleIt", String.class, String.class));
|
||||
|
||||
|
||||
+2
-2
@@ -170,7 +170,7 @@ class MessageListenerAdapterTests {
|
||||
@Override
|
||||
protected void handleListenerException(Throwable ex) {
|
||||
assertThat(ex).as("The Throwable passed to the handleListenerException(..) method must never be null.").isNotNull();
|
||||
assertThat(ex instanceof ListenerExecutionFailedException).as("The Throwable passed to the handleListenerException(..) method must be of type [ListenerExecutionFailedException].").isTrue();
|
||||
assertThat(ex).as("The Throwable passed to the handleListenerException(..) method must be of type [ListenerExecutionFailedException].").isInstanceOf(ListenerExecutionFailedException.class);
|
||||
ListenerExecutionFailedException lefx = (ListenerExecutionFailedException) ex;
|
||||
Throwable cause = lefx.getCause();
|
||||
assertThat(cause).as("The cause of a ListenerExecutionFailedException must be preserved.").isNotNull();
|
||||
@@ -186,7 +186,7 @@ class MessageListenerAdapterTests {
|
||||
void thatTheDefaultMessageConverterisIndeedTheSimpleMessageConverter() {
|
||||
MessageListenerAdapter adapter = new MessageListenerAdapter();
|
||||
assertThat(adapter.getMessageConverter()).as("The default [MessageConverter] must never be null.").isNotNull();
|
||||
assertThat(adapter.getMessageConverter() instanceof SimpleMessageConverter).as("The default [MessageConverter] must be of the type [SimpleMessageConverter]").isTrue();
|
||||
assertThat(adapter.getMessageConverter()).as("The default [MessageConverter] must be of the type [SimpleMessageConverter]").isInstanceOf(SimpleMessageConverter.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+4
-4
@@ -67,7 +67,7 @@ class HeadersMethodArgumentResolverTests {
|
||||
MethodParameter param = this.resolvable.annotPresent(Headers.class).arg(Map.class, String.class, Object.class);
|
||||
Object resolved = this.resolver.resolveArgument(param, this.message);
|
||||
|
||||
assertThat(resolved instanceof Map).isTrue();
|
||||
assertThat(resolved).isInstanceOf(Map.class);
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> headers = (Map<String, Object>) resolved;
|
||||
assertThat(headers.get("foo")).isEqualTo("bar");
|
||||
@@ -83,7 +83,7 @@ class HeadersMethodArgumentResolverTests {
|
||||
void resolveArgumentMessageHeaders() throws Exception {
|
||||
Object resolved = this.resolver.resolveArgument(this.resolvable.arg(MessageHeaders.class), this.message);
|
||||
|
||||
assertThat(resolved instanceof MessageHeaders).isTrue();
|
||||
assertThat(resolved).isInstanceOf(MessageHeaders.class);
|
||||
MessageHeaders headers = (MessageHeaders) resolved;
|
||||
assertThat(headers.get("foo")).isEqualTo("bar");
|
||||
}
|
||||
@@ -93,7 +93,7 @@ class HeadersMethodArgumentResolverTests {
|
||||
MethodParameter param = this.resolvable.arg(MessageHeaderAccessor.class);
|
||||
Object resolved = this.resolver.resolveArgument(param, this.message);
|
||||
|
||||
assertThat(resolved instanceof MessageHeaderAccessor).isTrue();
|
||||
assertThat(resolved).isInstanceOf(MessageHeaderAccessor.class);
|
||||
MessageHeaderAccessor headers = (MessageHeaderAccessor) resolved;
|
||||
assertThat(headers.getHeader("foo")).isEqualTo("bar");
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class HeadersMethodArgumentResolverTests {
|
||||
MethodParameter param = this.resolvable.arg(TestMessageHeaderAccessor.class);
|
||||
Object resolved = this.resolver.resolveArgument(param, this.message);
|
||||
|
||||
assertThat(resolved instanceof TestMessageHeaderAccessor).isTrue();
|
||||
assertThat(resolved).isInstanceOf(TestMessageHeaderAccessor.class);
|
||||
TestMessageHeaderAccessor headers = (TestMessageHeaderAccessor) resolved;
|
||||
assertThat(headers.getHeader("foo")).isEqualTo("bar");
|
||||
}
|
||||
|
||||
+2
-2
@@ -226,9 +226,9 @@ class MessageMethodArgumentResolverTests {
|
||||
this.resolver = new MessageMethodArgumentResolver(new MappingJackson2MessageConverter());
|
||||
Object actual = this.resolver.resolveArgument(parameter, inMessage);
|
||||
|
||||
assertThat(actual instanceof Message).isTrue();
|
||||
assertThat(actual).isInstanceOf(Message.class);
|
||||
Message<?> outMessage = (Message<?>) actual;
|
||||
assertThat(outMessage.getPayload() instanceof Foo).isTrue();
|
||||
assertThat(outMessage.getPayload()).isInstanceOf(Foo.class);
|
||||
assertThat(((Foo) outMessage.getPayload()).getFoo()).isEqualTo("bar");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ public abstract class AbstractEntityManagerFactoryBeanTests {
|
||||
protected void checkInvariants(AbstractEntityManagerFactoryBean emfb) {
|
||||
assertThat(EntityManagerFactory.class.isAssignableFrom(emfb.getObjectType())).isTrue();
|
||||
EntityManagerFactory emf = emfb.getObject();
|
||||
assertThat(emf instanceof EntityManagerFactoryInfo).as("Object created by factory implements EntityManagerFactoryInfo").isTrue();
|
||||
assertThat(emf).as("Object created by factory implements EntityManagerFactoryInfo").isInstanceOf(EntityManagerFactoryInfo.class);
|
||||
EntityManagerFactoryInfo emfi = (EntityManagerFactoryInfo) emf;
|
||||
assertThat(emfb.getObject()).as("Successive invocations of getObject() return same object").isSameAs(emfi);
|
||||
assertThat(emfb.getObject()).isSameAs(emfi);
|
||||
|
||||
@@ -96,7 +96,7 @@ public abstract class AbstractMarshallerTests<M extends Marshaller> {
|
||||
DocumentBuilder builder = documentBuilderFactory.newDocumentBuilder();
|
||||
DOMResult domResult = new DOMResult();
|
||||
marshaller.marshal(flights, domResult);
|
||||
assertThat(domResult.getNode() instanceof Document).as("DOMResult does not contain a Document").isTrue();
|
||||
assertThat(domResult.getNode()).as("DOMResult does not contain a Document").isInstanceOf(Document.class);
|
||||
Document result = (Document) domResult.getNode();
|
||||
Document expected = builder.newDocument();
|
||||
Element flightsElement = expected.createElementNS("http://samples.springframework.org/flight", "tns:flights");
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ class JndiJtaTransactionManagerTests {
|
||||
assertThat(ptm.getUserTransaction()).isEqualTo(ut);
|
||||
}
|
||||
else {
|
||||
assertThat(ptm.getUserTransaction() instanceof UserTransactionAdapter).isTrue();
|
||||
assertThat(ptm.getUserTransaction()).isInstanceOf(UserTransactionAdapter.class);
|
||||
UserTransactionAdapter uta = (UserTransactionAdapter) ptm.getUserTransaction();
|
||||
assertThat(uta.getTransactionManager()).isEqualTo(tm);
|
||||
}
|
||||
|
||||
+4
-4
@@ -116,11 +116,11 @@ class TransactionInterceptorTests extends AbstractTransactionAspectTests {
|
||||
ti.setTransactionManager(ptm);
|
||||
ti = SerializationTestUtils.serializeAndDeserialize(ti);
|
||||
|
||||
assertThat(ti.getTransactionManager() instanceof SerializableTransactionManager).isTrue();
|
||||
assertThat(ti.getTransactionAttributeSource() instanceof CompositeTransactionAttributeSource).isTrue();
|
||||
assertThat(ti.getTransactionManager()).isInstanceOf(SerializableTransactionManager.class);
|
||||
assertThat(ti.getTransactionAttributeSource()).isInstanceOf(CompositeTransactionAttributeSource.class);
|
||||
CompositeTransactionAttributeSource ctas = (CompositeTransactionAttributeSource) ti.getTransactionAttributeSource();
|
||||
assertThat(ctas.getTransactionAttributeSources()[0] instanceof NameMatchTransactionAttributeSource).isTrue();
|
||||
assertThat(ctas.getTransactionAttributeSources()[1] instanceof NameMatchTransactionAttributeSource).isTrue();
|
||||
assertThat(ctas.getTransactionAttributeSources()[0]).isInstanceOf(NameMatchTransactionAttributeSource.class);
|
||||
assertThat(ctas.getTransactionAttributeSources()[1]).isInstanceOf(NameMatchTransactionAttributeSource.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+2
-2
@@ -226,7 +226,7 @@ class ServletRequestDataBinderTests {
|
||||
|
||||
ServletRequestParameterPropertyValues pvs = new ServletRequestParameterPropertyValues(request);
|
||||
assertThat(pvs.getPropertyValues().length).as("Found 1 parameter").isEqualTo(1);
|
||||
assertThat(pvs.getPropertyValue("forname").getValue() instanceof String[]).as("Found array value").isTrue();
|
||||
assertThat(pvs.getPropertyValue("forname").getValue()).as("Found array value").isInstanceOf(String[].class);
|
||||
String[] values = (String[]) pvs.getPropertyValue("forname").getValue();
|
||||
assertThat(Arrays.asList(original)).as("Correct values").isEqualTo(Arrays.asList(values));
|
||||
}
|
||||
@@ -249,7 +249,7 @@ class ServletRequestDataBinderTests {
|
||||
for (PropertyValue element : ps) {
|
||||
Object val = m.get(element.getName());
|
||||
assertThat(val).as("Can't have unexpected value").isNotNull();
|
||||
assertThat(val instanceof String).as("Val i string").isTrue();
|
||||
assertThat(val).as("Val i string").isInstanceOf(String.class);
|
||||
assertThat(val.equals(element.getValue())).as("val matches expected").isTrue();
|
||||
m.remove(element.getName());
|
||||
}
|
||||
|
||||
+2
-2
@@ -332,7 +332,7 @@ class WebRequestDataBinderTests {
|
||||
for (PropertyValue pv : pvArray) {
|
||||
Object val = m.get(pv.getName());
|
||||
assertThat(val).as("Can't have unexpected value").isNotNull();
|
||||
assertThat(val instanceof String).as("Val i string").isTrue();
|
||||
assertThat(val).as("Val i string").isInstanceOf(String.class);
|
||||
assertThat(val.equals(pv.getValue())).as("val matches expected").isTrue();
|
||||
m.remove(pv.getName());
|
||||
}
|
||||
@@ -354,7 +354,7 @@ class WebRequestDataBinderTests {
|
||||
|
||||
ServletRequestParameterPropertyValues pvs = new ServletRequestParameterPropertyValues(request);
|
||||
assertThat(pvs.getPropertyValues().length).as("Found 1 parameter").isEqualTo(1);
|
||||
assertThat(pvs.getPropertyValue("forname").getValue() instanceof String[]).as("Found array value").isTrue();
|
||||
assertThat(pvs.getPropertyValue("forname").getValue()).as("Found array value").isInstanceOf(String[].class);
|
||||
String[] values = (String[]) pvs.getPropertyValue("forname").getValue();
|
||||
assertThat(Arrays.asList(original)).as("Correct values").isEqualTo(Arrays.asList(values));
|
||||
}
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ class ContextLoaderInitializerTests {
|
||||
void register() throws ServletException {
|
||||
initializer.onStartup(servletContext);
|
||||
|
||||
assertThat(eventListener instanceof ContextLoaderListener).isTrue();
|
||||
assertThat(eventListener).isInstanceOf(ContextLoaderListener.class);
|
||||
ContextLoaderListener cll = (ContextLoaderListener) eventListener;
|
||||
cll.contextInitialized(new ServletContextEvent(servletContext));
|
||||
|
||||
@@ -63,7 +63,7 @@ class ContextLoaderInitializerTests {
|
||||
.getRequiredWebApplicationContext(servletContext);
|
||||
|
||||
assertThat(applicationContext.containsBean(BEAN_NAME)).isTrue();
|
||||
assertThat(applicationContext.getBean(BEAN_NAME) instanceof MyBean).isTrue();
|
||||
assertThat(applicationContext.getBean(BEAN_NAME)).isInstanceOf(MyBean.class);
|
||||
}
|
||||
|
||||
private class MyMockServletContext extends MockServletContext {
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ class RequestScopeTests {
|
||||
String name = "requestScopedFactoryBean";
|
||||
assertThat(request.getAttribute(name)).isNull();
|
||||
TestBean bean = (TestBean) this.beanFactory.getBean(name);
|
||||
assertThat(request.getAttribute(name) instanceof FactoryBean).isTrue();
|
||||
assertThat(request.getAttribute(name)).isInstanceOf(FactoryBean.class);
|
||||
assertThat(this.beanFactory.getBean(name)).isSameAs(bean);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ class SpringBeanAutowiringSupportTests {
|
||||
|
||||
InjectionTarget target = new InjectionTarget();
|
||||
SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(target, sc);
|
||||
assertThat(target.testBean instanceof TestBean).isTrue();
|
||||
assertThat(target.testBean).isInstanceOf(TestBean.class);
|
||||
assertThat(target.name).isEqualTo("tb");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ class CookieValueMethodArgumentResolverTests {
|
||||
void resolveCookieDefaultValue() throws Exception {
|
||||
Object result = resolver.resolveArgument(paramNamedDefaultValueString, null, webRequest, null);
|
||||
|
||||
assertThat(result instanceof String).isTrue();
|
||||
assertThat(result).isInstanceOf(String.class);
|
||||
assertThat(result).as("Invalid result").isEqualTo("bar");
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -91,7 +91,7 @@ class RequestHeaderMapMethodArgumentResolverTests {
|
||||
|
||||
Object result = resolver.resolveArgument(paramMap, null, webRequest, null);
|
||||
|
||||
assertThat(result instanceof Map).isTrue();
|
||||
assertThat(result).isInstanceOf(Map.class);
|
||||
assertThat(result).as("Invalid result").isEqualTo(expected);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ class RequestHeaderMapMethodArgumentResolverTests {
|
||||
|
||||
Object result = resolver.resolveArgument(paramMultiValueMap, null, webRequest, null);
|
||||
|
||||
assertThat(result instanceof MultiValueMap).isTrue();
|
||||
assertThat(result).isInstanceOf(MultiValueMap.class);
|
||||
assertThat(result).as("Invalid result").isEqualTo(expected);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ class RequestHeaderMapMethodArgumentResolverTests {
|
||||
|
||||
Object result = resolver.resolveArgument(paramHttpHeaders, null, webRequest, null);
|
||||
|
||||
assertThat(result instanceof HttpHeaders).isTrue();
|
||||
assertThat(result).isInstanceOf(HttpHeaders.class);
|
||||
assertThat(result).as("Invalid result").isEqualTo(expected);
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -82,7 +82,7 @@ class RequestParamMapMethodArgumentResolverTests {
|
||||
MethodParameter param = this.testMethod.annot(requestParam().noName()).arg(Map.class, String.class, String.class);
|
||||
Object result = resolver.resolveArgument(param, null, webRequest, null);
|
||||
|
||||
assertThat(result instanceof Map).isTrue();
|
||||
assertThat(result).isInstanceOf(Map.class);
|
||||
assertThat(result).as("Invalid result").isEqualTo(expected);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ class RequestParamMapMethodArgumentResolverTests {
|
||||
MethodParameter param = this.testMethod.annotPresent(RequestParam.class).arg(MultiValueMap.class, String.class, String.class);
|
||||
Object result = resolver.resolveArgument(param, null, webRequest, null);
|
||||
|
||||
assertThat(result instanceof MultiValueMap).isTrue();
|
||||
assertThat(result).isInstanceOf(MultiValueMap.class);
|
||||
assertThat(result).as("Invalid result").isEqualTo(expected);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class RequestParamMapMethodArgumentResolverTests {
|
||||
MethodParameter param = this.testMethod.annot(requestParam().noName()).arg(Map.class, String.class, MultipartFile.class);
|
||||
Object result = resolver.resolveArgument(param, null, webRequest, null);
|
||||
|
||||
assertThat(result instanceof Map).isTrue();
|
||||
assertThat(result).isInstanceOf(Map.class);
|
||||
Map<String, MultipartFile> resultMap = (Map<String, MultipartFile>) result;
|
||||
assertThat(resultMap).hasSize(2);
|
||||
assertThat(resultMap.get("mfile")).isEqualTo(expected1);
|
||||
@@ -139,7 +139,7 @@ class RequestParamMapMethodArgumentResolverTests {
|
||||
MethodParameter param = this.testMethod.annot(requestParam().noName()).arg(MultiValueMap.class, String.class, MultipartFile.class);
|
||||
Object result = resolver.resolveArgument(param, null, webRequest, null);
|
||||
|
||||
assertThat(result instanceof MultiValueMap).isTrue();
|
||||
assertThat(result).isInstanceOf(MultiValueMap.class);
|
||||
MultiValueMap<String, MultipartFile> resultMap = (MultiValueMap<String, MultipartFile>) result;
|
||||
assertThat(resultMap).hasSize(2);
|
||||
assertThat(resultMap.get("mfilelist")).containsExactly(expected1, expected2);
|
||||
@@ -160,7 +160,7 @@ class RequestParamMapMethodArgumentResolverTests {
|
||||
MethodParameter param = this.testMethod.annot(requestParam().noName()).arg(Map.class, String.class, Part.class);
|
||||
Object result = resolver.resolveArgument(param, null, webRequest, null);
|
||||
|
||||
assertThat(result instanceof Map).isTrue();
|
||||
assertThat(result).isInstanceOf(Map.class);
|
||||
Map<String, Part> resultMap = (Map<String, Part>) result;
|
||||
assertThat(resultMap).hasSize(2);
|
||||
assertThat(resultMap.get("mfile")).isEqualTo(expected1);
|
||||
@@ -183,7 +183,7 @@ class RequestParamMapMethodArgumentResolverTests {
|
||||
MethodParameter param = this.testMethod.annot(requestParam().noName()).arg(MultiValueMap.class, String.class, Part.class);
|
||||
Object result = resolver.resolveArgument(param, null, webRequest, null);
|
||||
|
||||
assertThat(result instanceof MultiValueMap).isTrue();
|
||||
assertThat(result).isInstanceOf(MultiValueMap.class);
|
||||
MultiValueMap<String, Part> resultMap = (MultiValueMap<String, Part>) result;
|
||||
assertThat(resultMap).hasSize(2);
|
||||
assertThat(resultMap.get("mfilelist")).containsExactly(expected1, expected2);
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ class SessionAttributesHandlerTests {
|
||||
|
||||
assertThat(sessionAttributeStore.retrieveAttribute(request, "attr1")).isEqualTo("value1");
|
||||
assertThat(sessionAttributeStore.retrieveAttribute(request, "attr2")).isEqualTo("value2");
|
||||
assertThat(sessionAttributeStore.retrieveAttribute(request, "attr3") instanceof TestBean).isTrue();
|
||||
assertThat(sessionAttributeStore.retrieveAttribute(request, "attr3")).isInstanceOf(TestBean.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ class WebHttpHandlerBuilderTests {
|
||||
context.refresh();
|
||||
|
||||
HttpHandler httpHandler = WebHttpHandlerBuilder.applicationContext(context).build();
|
||||
assertThat(httpHandler instanceof HttpWebHandlerAdapter).isTrue();
|
||||
assertThat(httpHandler).isInstanceOf(HttpWebHandlerAdapter.class);
|
||||
assertThat(((HttpWebHandlerAdapter) httpHandler).getApplicationContext()).isSameAs(context);
|
||||
|
||||
MockServerHttpRequest request = MockServerHttpRequest.get("/").build();
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ class DelegatingWebFluxConfigurationTests {
|
||||
verify(webFluxConfigurer).configureArgumentResolvers(any());
|
||||
|
||||
assertThat(initializer).isNotNull();
|
||||
assertThat(initializer.getValidator() instanceof LocalValidatorFactoryBean).isTrue();
|
||||
assertThat(initializer.getValidator()).isInstanceOf(LocalValidatorFactoryBean.class);
|
||||
assertThat(initializer.getConversionService()).isSameAs(formatterRegistry.getValue());
|
||||
assertThat(codecsConfigurer.getValue().getReaders()).hasSize(16);
|
||||
}
|
||||
|
||||
+2
-2
@@ -79,7 +79,7 @@ class ResourceHandlerFunctionTests {
|
||||
|
||||
Mono<Void> result = responseMono.flatMap(response -> {
|
||||
assertThat(response.statusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(response instanceof EntityResponse).isTrue();
|
||||
assertThat(response).isInstanceOf(EntityResponse.class);
|
||||
@SuppressWarnings("unchecked")
|
||||
EntityResponse<Resource> entityResponse = (EntityResponse<Resource>) response;
|
||||
assertThat(entityResponse.entity()).isEqualTo(this.resource);
|
||||
@@ -115,7 +115,7 @@ class ResourceHandlerFunctionTests {
|
||||
|
||||
Mono<Void> result = responseMono.flatMap(response -> {
|
||||
assertThat(response.statusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(response instanceof EntityResponse).isTrue();
|
||||
assertThat(response).isInstanceOf(EntityResponse.class);
|
||||
@SuppressWarnings("unchecked")
|
||||
EntityResponse<Resource> entityResponse = (EntityResponse<Resource>) response;
|
||||
assertThat(entityResponse.entity().getFilename()).isEqualTo(this.resource.getFilename());
|
||||
|
||||
+3
-3
@@ -85,7 +85,7 @@ class EncodedResourceResolverTests {
|
||||
assertThat(actual.getDescription()).isEqualTo(getResource(file + ".gz").getDescription());
|
||||
assertThat(actual.getFilename()).isEqualTo(getResource(file).getFilename());
|
||||
|
||||
assertThat(actual instanceof HttpResource).isTrue();
|
||||
assertThat(actual).isInstanceOf(HttpResource.class);
|
||||
HttpHeaders headers = ((HttpResource) actual).getResponseHeaders();
|
||||
assertThat(headers.getFirst(HttpHeaders.CONTENT_ENCODING)).isEqualTo("gzip");
|
||||
assertThat(headers.getFirst(HttpHeaders.VARY)).isEqualTo("Accept-Encoding");
|
||||
@@ -102,7 +102,7 @@ class EncodedResourceResolverTests {
|
||||
|
||||
assertThat(actual.getDescription()).isEqualTo(getResource("foo.css.gz").getDescription());
|
||||
assertThat(actual.getFilename()).isEqualTo(getResource("foo.css").getFilename());
|
||||
assertThat(actual instanceof HttpResource).isTrue();
|
||||
assertThat(actual).isInstanceOf(HttpResource.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -119,7 +119,7 @@ class EncodedResourceResolverTests {
|
||||
|
||||
assertThat(resolved.getDescription()).isEqualTo(getResource(file + ".gz").getDescription());
|
||||
assertThat(resolved.getFilename()).isEqualTo(getResource(file).getFilename());
|
||||
assertThat(resolved instanceof HttpResource).isTrue();
|
||||
assertThat(resolved).isInstanceOf(HttpResource.class);
|
||||
|
||||
// 2. Resolve unencoded resource
|
||||
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ class CookieValueMethodArgumentResolverTests {
|
||||
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/"));
|
||||
Object result = this.resolver.resolveArgument(this.cookieStringParameter, this.bindingContext, exchange).block();
|
||||
|
||||
assertThat(result instanceof String).isTrue();
|
||||
assertThat(result).isInstanceOf(String.class);
|
||||
assertThat(result).isEqualTo("bar");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ class PathVariableMethodArgumentResolverTests {
|
||||
|
||||
StepVerifier.create(mono)
|
||||
.consumeNextWith(value -> {
|
||||
assertThat(value instanceof Optional).isTrue();
|
||||
assertThat(value).isInstanceOf(Optional.class);
|
||||
assertThat(((Optional<?>) value)).isNotPresent();
|
||||
})
|
||||
.expectComplete()
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ class RequestAttributeMethodArgumentResolverTests {
|
||||
this.exchange.getAttributes().put("fooMono", singleMono);
|
||||
mono = this.resolver.resolveArgument(param, new BindingContext(), this.exchange);
|
||||
Object value = mono.block(Duration.ZERO);
|
||||
assertThat(value instanceof Mono).isTrue();
|
||||
assertThat(value).isInstanceOf(Mono.class);
|
||||
assertThat(((Mono<?>) value).block(Duration.ZERO)).isSameAs(foo);
|
||||
|
||||
// No attribute --> Mono.empty
|
||||
|
||||
+2
-2
@@ -90,7 +90,7 @@ class RequestHeaderMapMethodArgumentResolverTests {
|
||||
Mono<Object> mono = resolver.resolveArgument(paramMap, null, exchange);
|
||||
Object result = mono.block();
|
||||
|
||||
assertThat(result instanceof Map).isTrue();
|
||||
assertThat(result).isInstanceOf(Map.class);
|
||||
assertThat(result).as("Invalid result").isEqualTo(expected);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ class RequestHeaderMapMethodArgumentResolverTests {
|
||||
Mono<Object> mono = resolver.resolveArgument(paramHttpHeaders, null, exchange);
|
||||
Object result = mono.block();
|
||||
|
||||
assertThat(result instanceof HttpHeaders).isTrue();
|
||||
assertThat(result).isInstanceOf(HttpHeaders.class);
|
||||
assertThat(result).as("Invalid result").isEqualTo(expected);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ class RequestParamMapMethodArgumentResolverTests {
|
||||
void resolveMapArgumentWithQueryString() {
|
||||
MethodParameter param = this.testMethod.annot(requestParam().name("")).arg(Map.class);
|
||||
Object result= resolve(param, MockServerWebExchange.from(MockServerHttpRequest.get("/path?foo=bar")));
|
||||
assertThat(result instanceof Map).isTrue();
|
||||
assertThat(result).isInstanceOf(Map.class);
|
||||
assertThat(result).isEqualTo(Collections.singletonMap("foo", "bar"));
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ class RequestParamMapMethodArgumentResolverTests {
|
||||
ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/path?foo=bar&foo=baz"));
|
||||
Object result= resolve(param, exchange);
|
||||
|
||||
assertThat(result instanceof MultiValueMap).isTrue();
|
||||
assertThat(result).isInstanceOf(MultiValueMap.class);
|
||||
assertThat(result).isEqualTo(Collections.singletonMap("foo", Arrays.asList("bar", "baz")));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ class SessionAttributesHandlerTests {
|
||||
|
||||
assertThat(session.getAttributes().get("attr1")).isEqualTo("value1");
|
||||
assertThat(session.getAttributes().get("attr2")).isEqualTo("value2");
|
||||
assertThat(session.getAttributes().get("attr3") instanceof TestBean).isTrue();
|
||||
assertThat(session.getAttributes().get("attr3")).isInstanceOf(TestBean.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class ContextLoaderTests {
|
||||
listener.contextInitialized(event);
|
||||
String contextAttr = WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE;
|
||||
WebApplicationContext context = (WebApplicationContext) sc.getAttribute(contextAttr);
|
||||
assertThat(context instanceof XmlWebApplicationContext).as("Correct WebApplicationContext exposed in ServletContext").isTrue();
|
||||
assertThat(context).as("Correct WebApplicationContext exposed in ServletContext").isInstanceOf(XmlWebApplicationContext.class);
|
||||
assertThat(WebApplicationContextUtils.getRequiredWebApplicationContext(sc)).isInstanceOf(
|
||||
XmlWebApplicationContext.class);
|
||||
LifecycleBean lb = (LifecycleBean) context.getBean("lifecycle");
|
||||
@@ -239,7 +239,7 @@ class ContextLoaderTests {
|
||||
listener.contextInitialized(event);
|
||||
String contextAttr = WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE;
|
||||
WebApplicationContext wc = (WebApplicationContext) sc.getAttribute(contextAttr);
|
||||
assertThat(wc instanceof SimpleWebApplicationContext).as("Correct WebApplicationContext exposed in ServletContext").isTrue();
|
||||
assertThat(wc).as("Correct WebApplicationContext exposed in ServletContext").isInstanceOf(SimpleWebApplicationContext.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+4
-4
@@ -112,7 +112,7 @@ class DelegatingWebMvcConfigurationTests {
|
||||
|
||||
assertThat(initializer).isNotNull();
|
||||
assertThat(initializer.getConversionService()).isSameAs(conversionService.getValue());
|
||||
assertThat(initializer.getValidator() instanceof LocalValidatorFactoryBean).isTrue();
|
||||
assertThat(initializer.getValidator()).isInstanceOf(LocalValidatorFactoryBean.class);
|
||||
assertThat(resolvers.getValue()).isEmpty();
|
||||
assertThat(handlers.getValue()).isEmpty();
|
||||
assertThat(adapter.getMessageConverters()).isEqualTo(converters.getValue());
|
||||
@@ -170,9 +170,9 @@ class DelegatingWebMvcConfigurationTests {
|
||||
verify(webMvcConfigurer).configureHandlerExceptionResolvers(exceptionResolvers.capture());
|
||||
|
||||
assertThat(exceptionResolvers.getValue()).hasSize(3);
|
||||
assertThat(exceptionResolvers.getValue().get(0) instanceof ExceptionHandlerExceptionResolver).isTrue();
|
||||
assertThat(exceptionResolvers.getValue().get(1) instanceof ResponseStatusExceptionResolver).isTrue();
|
||||
assertThat(exceptionResolvers.getValue().get(2) instanceof DefaultHandlerExceptionResolver).isTrue();
|
||||
assertThat(exceptionResolvers.getValue().get(0)).isInstanceOf(ExceptionHandlerExceptionResolver.class);
|
||||
assertThat(exceptionResolvers.getValue().get(1)).isInstanceOf(ResponseStatusExceptionResolver.class);
|
||||
assertThat(exceptionResolvers.getValue().get(2)).isInstanceOf(DefaultHandlerExceptionResolver.class);
|
||||
assertThat(converters.getValue()).isNotEmpty();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -202,7 +202,7 @@ class InterceptorRegistryTests {
|
||||
private void verifyWebInterceptor(HandlerInterceptor interceptor,
|
||||
TestWebRequestInterceptor webInterceptor) throws Exception {
|
||||
|
||||
assertThat(interceptor instanceof WebRequestHandlerInterceptorAdapter).isTrue();
|
||||
assertThat(interceptor).isInstanceOf(WebRequestHandlerInterceptorAdapter.class);
|
||||
interceptor.preHandle(this.request, this.response, null);
|
||||
assertThat(webInterceptor.preHandleInvoked).isTrue();
|
||||
}
|
||||
|
||||
+2
-2
@@ -198,11 +198,11 @@ class WebMvcConfigurationSupportTests {
|
||||
|
||||
ConversionService conversionService = initializer.getConversionService();
|
||||
assertThat(conversionService).isNotNull();
|
||||
assertThat(conversionService instanceof FormattingConversionService).isTrue();
|
||||
assertThat(conversionService).isInstanceOf(FormattingConversionService.class);
|
||||
|
||||
Validator validator = initializer.getValidator();
|
||||
assertThat(validator).isNotNull();
|
||||
assertThat(validator instanceof LocalValidatorFactoryBean).isTrue();
|
||||
assertThat(validator).isInstanceOf(LocalValidatorFactoryBean.class);
|
||||
|
||||
DirectFieldAccessor fieldAccessor = new DirectFieldAccessor(adapter);
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
+3
-3
@@ -93,7 +93,7 @@ class LocaleResolverTests {
|
||||
else {
|
||||
assertThat(localeContext.getLocale()).isEqualTo(Locale.UK);
|
||||
}
|
||||
assertThat(localeContext instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
assertThat(localeContext).isInstanceOf(TimeZoneAwareLocaleContext.class);
|
||||
assertThat(((TimeZoneAwareLocaleContext) localeContext).getTimeZone()).isNull();
|
||||
|
||||
if (localeContextResolver instanceof AbstractLocaleContextResolver) {
|
||||
@@ -121,14 +121,14 @@ class LocaleResolverTests {
|
||||
new SimpleTimeZoneAwareLocaleContext(Locale.GERMANY, TimeZone.getTimeZone("GMT+2")));
|
||||
localeContext = localeContextResolver.resolveLocaleContext(request);
|
||||
assertThat(localeContext.getLocale()).isEqualTo(Locale.GERMANY);
|
||||
assertThat(localeContext instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
assertThat(localeContext).isInstanceOf(TimeZoneAwareLocaleContext.class);
|
||||
assertThat(TimeZone.getTimeZone("GMT+2")).isEqualTo(((TimeZoneAwareLocaleContext) localeContext).getTimeZone());
|
||||
|
||||
localeContextResolver.setLocaleContext(request, response,
|
||||
new SimpleTimeZoneAwareLocaleContext(null, TimeZone.getTimeZone("GMT+3")));
|
||||
localeContext = localeContextResolver.resolveLocaleContext(request);
|
||||
assertThat(localeContext.getLocale()).isEqualTo(Locale.UK);
|
||||
assertThat(localeContext instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
assertThat(localeContext).isInstanceOf(TimeZoneAwareLocaleContext.class);
|
||||
assertThat(TimeZone.getTimeZone("GMT+3")).isEqualTo(((TimeZoneAwareLocaleContext) localeContext).getTimeZone());
|
||||
|
||||
if (localeContextResolver instanceof AbstractLocaleContextResolver) {
|
||||
|
||||
+3
-3
@@ -396,7 +396,7 @@ class RequestPartMethodArgumentResolverTests {
|
||||
webRequest = new ServletWebRequest(request);
|
||||
|
||||
Object actualValue = resolver.resolveArgument(optionalMultipartFileList, null, webRequest, null);
|
||||
assertThat(actualValue instanceof Optional).isTrue();
|
||||
assertThat(actualValue).isInstanceOf(Optional.class);
|
||||
assertThat(((Optional<?>) actualValue).get()).as("Invalid result").isEqualTo(Collections.singletonList(expected));
|
||||
|
||||
actualValue = resolver.resolveArgument(optionalMultipartFileList, null, webRequest, null);
|
||||
@@ -438,7 +438,7 @@ class RequestPartMethodArgumentResolverTests {
|
||||
webRequest = new ServletWebRequest(request);
|
||||
|
||||
Object actualValue = resolver.resolveArgument(optionalPart, null, webRequest, null);
|
||||
assertThat(actualValue instanceof Optional).isTrue();
|
||||
assertThat(actualValue).isInstanceOf(Optional.class);
|
||||
assertThat(((Optional<?>) actualValue).get()).as("Invalid result").isEqualTo(expected);
|
||||
|
||||
actualValue = resolver.resolveArgument(optionalPart, null, webRequest, null);
|
||||
@@ -482,7 +482,7 @@ class RequestPartMethodArgumentResolverTests {
|
||||
webRequest = new ServletWebRequest(request);
|
||||
|
||||
Object actualValue = resolver.resolveArgument(optionalPartList, null, webRequest, null);
|
||||
assertThat(actualValue instanceof Optional).isTrue();
|
||||
assertThat(actualValue).isInstanceOf(Optional.class);
|
||||
assertThat(((Optional<?>) actualValue).get()).as("Invalid result").isEqualTo(Collections.singletonList(expected));
|
||||
|
||||
actualValue = resolver.resolveArgument(optionalPartList, null, webRequest, null);
|
||||
|
||||
+2
-2
@@ -398,8 +398,8 @@ class ResponseEntityExceptionHandlerTests {
|
||||
servlet.service(this.servletRequest, this.servletResponse);
|
||||
}
|
||||
catch (ServletException ex) {
|
||||
assertThat(ex.getCause() instanceof IllegalStateException).isTrue();
|
||||
assertThat(ex.getCause().getCause() instanceof ServletRequestBindingException).isTrue();
|
||||
assertThat(ex.getCause()).isInstanceOf(IllegalStateException.class);
|
||||
assertThat(ex.getCause().getCause()).isInstanceOf(ServletRequestBindingException.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -2644,7 +2644,7 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
|
||||
public String myOtherHandle(TB tb, BindingResult errors, ExtendedModelMap model, MySpecialArg arg) {
|
||||
TestBean tbReal = (TestBean) tb;
|
||||
tbReal.setName("myName");
|
||||
assertThat(model.get("ITestBean") instanceof DerivedTestBean).isTrue();
|
||||
assertThat(model.get("ITestBean")).isInstanceOf(DerivedTestBean.class);
|
||||
assertThat(arg).isNotNull();
|
||||
return super.myHandle(tbReal, errors, model);
|
||||
}
|
||||
|
||||
+3
-3
@@ -78,7 +78,7 @@ class EncodedResourceResolverTests {
|
||||
assertThat(actual.getDescription()).isEqualTo(getResource(file + ".gz").getDescription());
|
||||
assertThat(actual.getFilename()).isEqualTo(getResource(file).getFilename());
|
||||
|
||||
assertThat(actual instanceof HttpResource).isTrue();
|
||||
assertThat(actual).isInstanceOf(HttpResource.class);
|
||||
HttpHeaders headers = ((HttpResource) actual).getResponseHeaders();
|
||||
assertThat(headers.getFirst(HttpHeaders.CONTENT_ENCODING)).isEqualTo("gzip");
|
||||
assertThat(headers.getFirst(HttpHeaders.VARY)).isEqualTo("Accept-Encoding");
|
||||
@@ -94,7 +94,7 @@ class EncodedResourceResolverTests {
|
||||
|
||||
assertThat(resolved.getDescription()).isEqualTo(getResource("foo.css.gz").getDescription());
|
||||
assertThat(resolved.getFilename()).isEqualTo(getResource("foo.css").getFilename());
|
||||
assertThat(resolved instanceof HttpResource).isTrue();
|
||||
assertThat(resolved).isInstanceOf(HttpResource.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -108,7 +108,7 @@ class EncodedResourceResolverTests {
|
||||
|
||||
assertThat(resolved.getDescription()).isEqualTo(getResource(file + ".gz").getDescription());
|
||||
assertThat(resolved.getFilename()).isEqualTo(getResource(file).getFilename());
|
||||
assertThat(resolved instanceof HttpResource).isTrue();
|
||||
assertThat(resolved).isInstanceOf(HttpResource.class);
|
||||
|
||||
// 2. Resolve unencoded resource
|
||||
request = new MockHttpServletRequest("GET", "/js/foo.js");
|
||||
|
||||
+2
-2
@@ -92,7 +92,7 @@ class AnnotationConfigDispatcherServletInitializerTests {
|
||||
((AnnotationConfigWebApplicationContext) wac).refresh();
|
||||
|
||||
assertThat(wac.containsBean("bean")).isTrue();
|
||||
assertThat(wac.getBean("bean") instanceof MyBean).isTrue();
|
||||
assertThat(wac.getBean("bean")).isInstanceOf(MyBean.class);
|
||||
|
||||
assertThat(servletRegistrations).hasSize(1);
|
||||
assertThat(servletRegistrations.get(SERVLET_NAME)).isNotNull();
|
||||
@@ -160,7 +160,7 @@ class AnnotationConfigDispatcherServletInitializerTests {
|
||||
((AnnotationConfigWebApplicationContext) wac).refresh();
|
||||
|
||||
assertThat(wac.containsBean("bean")).isTrue();
|
||||
assertThat(wac.getBean("bean") instanceof MyBean).isTrue();
|
||||
assertThat(wac.getBean("bean")).isInstanceOf(MyBean.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ class DispatcherServletInitializerTests {
|
||||
WebApplicationContext servletContext = servlet.getWebApplicationContext();
|
||||
|
||||
assertThat(servletContext.containsBean("bean")).isTrue();
|
||||
assertThat(servletContext.getBean("bean") instanceof MyBean).isTrue();
|
||||
assertThat(servletContext.getBean("bean")).isInstanceOf(MyBean.class);
|
||||
|
||||
assertThat(registrations).hasSize(1);
|
||||
assertThat(registrations.get(SERVLET_NAME)).isNotNull();
|
||||
|
||||
@@ -479,7 +479,7 @@ class BindTagTests extends AbstractTagTests {
|
||||
BindStatus status = (BindStatus) pc.getAttribute(BindTag.STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
|
||||
assertThat(status).as("Has status variable").isNotNull();
|
||||
assertThat(status.getExpression()).as("Correct expression").isEqualTo("array[0]");
|
||||
assertThat(status.getValue() instanceof TestBean).as("Value is TestBean").isTrue();
|
||||
assertThat(status.getValue()).as("Value is TestBean").isInstanceOf(TestBean.class);
|
||||
assertThat(((TestBean) status.getValue()).getName()).as("Correct value").isEqualTo("name0");
|
||||
assertThat(status.isError()).as("Correct isError").isTrue();
|
||||
assertThat(status.getErrorCodes()).as("Correct errorCodes").hasSize(2);
|
||||
@@ -506,7 +506,7 @@ class BindTagTests extends AbstractTagTests {
|
||||
BindStatus status = (BindStatus) pc.getAttribute(BindTag.STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
|
||||
assertThat(status).as("Has status variable").isNotNull();
|
||||
assertThat(status.getExpression()).as("Correct expression").isEqualTo("map[key1]");
|
||||
assertThat(status.getValue() instanceof TestBean).as("Value is TestBean").isTrue();
|
||||
assertThat(status.getValue()).as("Value is TestBean").isInstanceOf(TestBean.class);
|
||||
assertThat(((TestBean) status.getValue()).getName()).as("Correct value").isEqualTo("name4");
|
||||
assertThat(status.isError()).as("Correct isError").isTrue();
|
||||
assertThat(status.getErrorCodes()).as("Correct errorCodes").hasSize(2);
|
||||
@@ -541,7 +541,7 @@ class BindTagTests extends AbstractTagTests {
|
||||
assertThat(status).as("Has status variable").isNotNull();
|
||||
assertThat(status.getExpression()).as("Correct expression").isEqualTo("array[0]");
|
||||
// because of the custom editor getValue() should return a String
|
||||
assertThat(status.getValue() instanceof String).as("Value is TestBean").isTrue();
|
||||
assertThat(status.getValue()).as("Value is TestBean").isInstanceOf(String.class);
|
||||
assertThat(status.getValue()).as("Correct value").isEqualTo("something");
|
||||
}
|
||||
|
||||
@@ -559,7 +559,7 @@ class BindTagTests extends AbstractTagTests {
|
||||
tag.doStartTag();
|
||||
BindStatus status = (BindStatus) pc.getAttribute(BindTag.STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
|
||||
assertThat(status.getExpression()).isEqualTo("doctor");
|
||||
assertThat(status.getValue() instanceof NestedTestBean).isTrue();
|
||||
assertThat(status.getValue()).isInstanceOf(NestedTestBean.class);
|
||||
assertThat(status.getDisplayValue()).contains("juergen&eva");
|
||||
}
|
||||
|
||||
@@ -574,7 +574,7 @@ class BindTagTests extends AbstractTagTests {
|
||||
tag.doStartTag();
|
||||
BindStatus status = (BindStatus) pc.getAttribute(BindTag.STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
|
||||
assertThat(status.getExpression()).isEqualTo("someSet");
|
||||
assertThat(status.getValue() instanceof Set).isTrue();
|
||||
assertThat(status.getValue()).isInstanceOf(Set.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+2
-2
@@ -346,7 +346,7 @@ class ErrorsTagTests extends AbstractFormTagTests {
|
||||
int result = this.tag.doStartTag();
|
||||
assertThat(result).isEqualTo(BodyTag.EVAL_BODY_BUFFERED);
|
||||
assertThat(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE)).isNotNull();
|
||||
assertThat(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE) instanceof List).isTrue();
|
||||
assertThat(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE)).isInstanceOf(List.class);
|
||||
String bodyContent = "Foo";
|
||||
this.tag.setBodyContent(new MockBodyContent(bodyContent, getWriter()));
|
||||
this.tag.doEndTag();
|
||||
@@ -366,7 +366,7 @@ class ErrorsTagTests extends AbstractFormTagTests {
|
||||
int result = this.tag.doStartTag();
|
||||
assertThat(result).isEqualTo(BodyTag.EVAL_BODY_BUFFERED);
|
||||
assertThat(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE)).isNotNull();
|
||||
assertThat(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE) instanceof List).isTrue();
|
||||
assertThat(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE)).isInstanceOf(List.class);
|
||||
String bodyContent = "Foo";
|
||||
this.tag.setBodyContent(new MockBodyContent(bodyContent, getWriter()));
|
||||
this.tag.doEndTag();
|
||||
|
||||
+1
-1
@@ -176,7 +176,7 @@ class ViewResolverTests {
|
||||
model.put("tb", tb);
|
||||
view.render(model, this.request, this.response);
|
||||
assertThat(tb.equals(this.request.getAttribute("tb"))).as("Correct tb attribute").isTrue();
|
||||
assertThat(this.request.getAttribute("rc") instanceof RequestContext).as("Correct rc attribute").isTrue();
|
||||
assertThat(this.request.getAttribute("rc")).as("Correct rc attribute").isInstanceOf(RequestContext.class);
|
||||
|
||||
view = vr.resolveViewName("redirect:myUrl", Locale.getDefault());
|
||||
assertThat(view.getClass()).as("Correct view class").isEqualTo(RedirectView.class);
|
||||
|
||||
+8
-8
@@ -83,7 +83,7 @@ class HandlersBeanDefinitionParserTests {
|
||||
assertThat(handlersMap).hasSize(2);
|
||||
|
||||
for (HandlerMapping hm : handlersMap.values()) {
|
||||
assertThat(hm instanceof SimpleUrlHandlerMapping).isTrue();
|
||||
assertThat(hm).isInstanceOf(SimpleUrlHandlerMapping.class);
|
||||
SimpleUrlHandlerMapping shm = (SimpleUrlHandlerMapping) hm;
|
||||
|
||||
if (shm.getUrlMap().containsKey("/foo")) {
|
||||
@@ -93,9 +93,9 @@ class HandlersBeanDefinitionParserTests {
|
||||
unwrapAndCheckDecoratedHandlerType(handler.getWebSocketHandler(), FooWebSocketHandler.class);
|
||||
HandshakeHandler handshakeHandler = handler.getHandshakeHandler();
|
||||
assertThat(handshakeHandler).isNotNull();
|
||||
assertThat(handshakeHandler instanceof DefaultHandshakeHandler).isTrue();
|
||||
assertThat(handshakeHandler).isInstanceOf(DefaultHandshakeHandler.class);
|
||||
assertThat(handler.getHandshakeInterceptors()).isNotEmpty();
|
||||
assertThat(handler.getHandshakeInterceptors().get(0) instanceof OriginHandshakeInterceptor).isTrue();
|
||||
assertThat(handler.getHandshakeInterceptors().get(0)).isInstanceOf(OriginHandshakeInterceptor.class);
|
||||
}
|
||||
else {
|
||||
assertThat(shm.getUrlMap()).containsOnlyKeys("/test");
|
||||
@@ -104,9 +104,9 @@ class HandlersBeanDefinitionParserTests {
|
||||
unwrapAndCheckDecoratedHandlerType(handler.getWebSocketHandler(), TestWebSocketHandler.class);
|
||||
HandshakeHandler handshakeHandler = handler.getHandshakeHandler();
|
||||
assertThat(handshakeHandler).isNotNull();
|
||||
assertThat(handshakeHandler instanceof DefaultHandshakeHandler).isTrue();
|
||||
assertThat(handshakeHandler).isInstanceOf(DefaultHandshakeHandler.class);
|
||||
assertThat(handler.getHandshakeInterceptors()).isNotEmpty();
|
||||
assertThat(handler.getHandshakeInterceptors().get(0) instanceof OriginHandshakeInterceptor).isTrue();
|
||||
assertThat(handler.getHandshakeInterceptors().get(0)).isInstanceOf(OriginHandshakeInterceptor.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,7 @@ class HandlersBeanDefinitionParserTests {
|
||||
|
||||
HandlerMapping handlerMapping = this.appContext.getBean(HandlerMapping.class);
|
||||
assertThat(handlerMapping).isNotNull();
|
||||
assertThat(handlerMapping instanceof SimpleUrlHandlerMapping).isTrue();
|
||||
assertThat(handlerMapping).isInstanceOf(SimpleUrlHandlerMapping.class);
|
||||
|
||||
SimpleUrlHandlerMapping urlHandlerMapping = (SimpleUrlHandlerMapping) handlerMapping;
|
||||
assertThat(urlHandlerMapping.getOrder()).isEqualTo(2);
|
||||
@@ -127,7 +127,7 @@ class HandlersBeanDefinitionParserTests {
|
||||
unwrapAndCheckDecoratedHandlerType(handler.getWebSocketHandler(), FooWebSocketHandler.class);
|
||||
HandshakeHandler handshakeHandler = handler.getHandshakeHandler();
|
||||
assertThat(handshakeHandler).isNotNull();
|
||||
assertThat(handshakeHandler instanceof TestHandshakeHandler).isTrue();
|
||||
assertThat(handshakeHandler).isInstanceOf(TestHandshakeHandler.class);
|
||||
List<HandshakeInterceptor> interceptors = handler.getHandshakeInterceptors();
|
||||
assertThat(interceptors).extracting("class")
|
||||
.containsExactlyInAnyOrder(FooTestInterceptor.class, BarTestInterceptor.class, OriginHandshakeInterceptor.class);
|
||||
@@ -137,7 +137,7 @@ class HandlersBeanDefinitionParserTests {
|
||||
unwrapAndCheckDecoratedHandlerType(handler.getWebSocketHandler(), TestWebSocketHandler.class);
|
||||
handshakeHandler = handler.getHandshakeHandler();
|
||||
assertThat(handshakeHandler).isNotNull();
|
||||
assertThat(handshakeHandler instanceof TestHandshakeHandler).isTrue();
|
||||
assertThat(handshakeHandler).isInstanceOf(TestHandshakeHandler.class);
|
||||
interceptors = handler.getHandshakeInterceptors();
|
||||
assertThat(interceptors).extracting("class")
|
||||
.containsExactlyInAnyOrder(FooTestInterceptor.class, BarTestInterceptor.class, OriginHandshakeInterceptor.class);
|
||||
|
||||
Reference in New Issue
Block a user