mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Inline conditions in assertThat() statements
Search: assertThat\(conditions?[0-9]?\) See gh-36504
This commit is contained in:
+5
-10
@@ -63,8 +63,7 @@ class AopNamespaceHandlerScopeIntegrationTests {
|
||||
@Test
|
||||
void singletonScoping() throws Exception {
|
||||
assertThat(AopUtils.isAopProxy(singletonScoped)).as("Should be AOP proxy").isTrue();
|
||||
boolean condition = singletonScoped instanceof TestBean;
|
||||
assertThat(condition).as("Should be target class proxy").isTrue();
|
||||
assertThat(singletonScoped instanceof TestBean).as("Should be target class proxy").isTrue();
|
||||
String rob = "Rob Harrop";
|
||||
String bram = "Bram Smeets";
|
||||
assertThat(singletonScoped.getName()).isEqualTo(rob);
|
||||
@@ -82,12 +81,10 @@ class AopNamespaceHandlerScopeIntegrationTests {
|
||||
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(oldRequest));
|
||||
|
||||
assertThat(AopUtils.isAopProxy(requestScoped)).as("Should be AOP proxy").isTrue();
|
||||
boolean condition = requestScoped instanceof TestBean;
|
||||
assertThat(condition).as("Should be target class proxy").isTrue();
|
||||
assertThat(requestScoped instanceof TestBean).as("Should be target class proxy").isTrue();
|
||||
|
||||
assertThat(AopUtils.isAopProxy(testBean)).as("Should be AOP proxy").isTrue();
|
||||
boolean condition1 = testBean instanceof TestBean;
|
||||
assertThat(condition1).as("Regular bean should be JDK proxy").isFalse();
|
||||
assertThat(testBean instanceof TestBean).as("Regular bean should be JDK proxy").isFalse();
|
||||
|
||||
String rob = "Rob Harrop";
|
||||
String bram = "Bram Smeets";
|
||||
@@ -112,14 +109,12 @@ class AopNamespaceHandlerScopeIntegrationTests {
|
||||
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
|
||||
|
||||
assertThat(AopUtils.isAopProxy(sessionScoped)).as("Should be AOP proxy").isTrue();
|
||||
boolean condition1 = sessionScoped instanceof TestBean;
|
||||
assertThat(condition1).as("Should not be target class proxy").isFalse();
|
||||
assertThat(sessionScoped instanceof TestBean).as("Should not be target class proxy").isFalse();
|
||||
|
||||
assertThat(sessionScopedAlias).isSameAs(sessionScoped);
|
||||
|
||||
assertThat(AopUtils.isAopProxy(testBean)).as("Should be AOP proxy").isTrue();
|
||||
boolean condition = testBean instanceof TestBean;
|
||||
assertThat(condition).as("Regular bean should be JDK proxy").isFalse();
|
||||
assertThat(testBean instanceof TestBean).as("Regular bean should be JDK proxy").isFalse();
|
||||
|
||||
String rob = "Rob Harrop";
|
||||
String bram = "Bram Smeets";
|
||||
|
||||
+1
-2
@@ -168,8 +168,7 @@ class AdvisorAutoProxyCreatorIntegrationTests {
|
||||
BeanFactory bf = getBeanFactory();
|
||||
|
||||
Object bean = bf.getBean(TXMANAGER_BEAN_NAME);
|
||||
boolean condition = bean instanceof CallCountingTransactionManager;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(bean instanceof CallCountingTransactionManager).isTrue();
|
||||
CallCountingTransactionManager txMan = (CallCountingTransactionManager) bf.getBean(TXMANAGER_BEAN_NAME);
|
||||
|
||||
Rollback rb = (Rollback) bf.getBean("rollback");
|
||||
|
||||
+5
-10
@@ -185,8 +185,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
|
||||
|
||||
// should be dynamic proxy, implementing both interfaces
|
||||
assertThat(AopUtils.isJdkDynamicProxy(bean)).isTrue();
|
||||
boolean condition = bean instanceof AnotherScopeTestInterface;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(bean instanceof AnotherScopeTestInterface).isTrue();
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
@@ -207,8 +206,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
|
||||
|
||||
// should be a class-based proxy
|
||||
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
|
||||
boolean condition = bean instanceof RequestScopedTestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(bean instanceof RequestScopedTestBean).isTrue();
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
@@ -250,8 +248,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
|
||||
|
||||
// should be dynamic proxy, implementing both interfaces
|
||||
assertThat(AopUtils.isJdkDynamicProxy(bean)).isTrue();
|
||||
boolean condition = bean instanceof AnotherScopeTestInterface;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(bean instanceof AnotherScopeTestInterface).isTrue();
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
@@ -278,10 +275,8 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
|
||||
|
||||
// should be a class-based proxy
|
||||
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
|
||||
boolean condition1 = bean instanceof ScopedTestBean;
|
||||
assertThat(condition1).isTrue();
|
||||
boolean condition = bean instanceof SessionScopedTestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(bean instanceof ScopedTestBean).isTrue();
|
||||
assertThat(bean instanceof SessionScopedTestBean).isTrue();
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
|
||||
+5
-10
@@ -166,8 +166,7 @@ class ClassPathBeanDefinitionScannerScopeIntegrationTests {
|
||||
|
||||
// should be dynamic proxy, implementing both interfaces
|
||||
assertThat(AopUtils.isJdkDynamicProxy(bean)).isTrue();
|
||||
boolean condition = bean instanceof AnotherScopeTestInterface;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(bean instanceof AnotherScopeTestInterface).isTrue();
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
@@ -188,8 +187,7 @@ class ClassPathBeanDefinitionScannerScopeIntegrationTests {
|
||||
|
||||
// should be a class-based proxy
|
||||
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
|
||||
boolean condition = bean instanceof RequestScopedTestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(bean instanceof RequestScopedTestBean).isTrue();
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
@@ -231,8 +229,7 @@ class ClassPathBeanDefinitionScannerScopeIntegrationTests {
|
||||
|
||||
// should be dynamic proxy, implementing both interfaces
|
||||
assertThat(AopUtils.isJdkDynamicProxy(bean)).isTrue();
|
||||
boolean condition = bean instanceof AnotherScopeTestInterface;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(bean instanceof AnotherScopeTestInterface).isTrue();
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
@@ -259,10 +256,8 @@ class ClassPathBeanDefinitionScannerScopeIntegrationTests {
|
||||
|
||||
// should be a class-based proxy
|
||||
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
|
||||
boolean condition1 = bean instanceof ScopedTestBean;
|
||||
assertThat(condition1).isTrue();
|
||||
boolean condition = bean instanceof SessionScopedTestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(bean instanceof ScopedTestBean).isTrue();
|
||||
assertThat(bean instanceof SessionScopedTestBean).isTrue();
|
||||
|
||||
assertThat(bean.getName()).isEqualTo(DEFAULT_NAME);
|
||||
bean.setName(MODIFIED_NAME);
|
||||
|
||||
+1
-2
@@ -63,8 +63,7 @@ class AspectJPointcutAdvisorTests {
|
||||
1, "someBean");
|
||||
|
||||
assertThat(ajpa.getAspectMetadata().getPerClausePointcut()).isNotSameAs(Pointcut.TRUE);
|
||||
boolean condition = ajpa.getAspectMetadata().getPerClausePointcut() instanceof AspectJExpressionPointcut;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(ajpa.getAspectMetadata().getPerClausePointcut() instanceof AspectJExpressionPointcut).isTrue();
|
||||
assertThat(ajpa.isPerInstance()).isTrue();
|
||||
|
||||
assertThat(ajpa.getAspectMetadata().getPerClausePointcut().getClassFilter().matches(TestBean.class)).isTrue();
|
||||
|
||||
+2
-4
@@ -54,8 +54,7 @@ class ExposeBeanNameAdvisorsTests {
|
||||
pf.addAdvisor(ExposeBeanNameAdvisors.createAdvisorWithoutIntroduction(beanName));
|
||||
ITestBean proxy = (ITestBean) pf.getProxy();
|
||||
|
||||
boolean condition = proxy instanceof NamedBean;
|
||||
assertThat(condition).as("No introduction").isFalse();
|
||||
assertThat(proxy instanceof NamedBean).as("No introduction").isFalse();
|
||||
// Requires binding
|
||||
proxy.getAge();
|
||||
}
|
||||
@@ -69,8 +68,7 @@ class ExposeBeanNameAdvisorsTests {
|
||||
pf.addAdvisor(ExposeBeanNameAdvisors.createAdvisorIntroducingNamedBean(beanName));
|
||||
ITestBean proxy = (ITestBean) pf.getProxy();
|
||||
|
||||
boolean condition = proxy instanceof NamedBean;
|
||||
assertThat(condition).as("Introduction was made").isTrue();
|
||||
assertThat(proxy instanceof NamedBean).as("Introduction was made").isTrue();
|
||||
// Requires binding
|
||||
proxy.getAge();
|
||||
|
||||
|
||||
+2
-4
@@ -90,8 +90,7 @@ public abstract class AbstractBeanFactoryTests {
|
||||
// The dummy business method will throw an exception if the
|
||||
// necessary callbacks weren't invoked in the right order.
|
||||
lb.businessMethod();
|
||||
boolean condition = !lb.isDestroyed();
|
||||
assertThat(condition).as("Not destroyed").isTrue();
|
||||
assertThat(!lb.isDestroyed()).as("Not destroyed").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -161,8 +160,7 @@ public abstract class AbstractBeanFactoryTests {
|
||||
tb2.setAge(2);
|
||||
assertThat(tb1.getAge()).as("1 age independent = 1").isEqualTo(1);
|
||||
assertThat(tb2.getAge()).as("2 age independent = 2").isEqualTo(2);
|
||||
boolean condition = !tb1.equals(tb2);
|
||||
assertThat(condition).as("object equal now false").isTrue();
|
||||
assertThat(!tb1.equals(tb2)).as("object equal now false").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+2
-4
@@ -133,12 +133,10 @@ class SimpleMailMessageTests {
|
||||
// Null object is not equal
|
||||
message1 = new SimpleMailMessage();
|
||||
message2 = null;
|
||||
boolean condition1 = !(message1.equals(message2));
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(!(message1.equals(message2))).isTrue();
|
||||
|
||||
// Different class is not equal
|
||||
boolean condition = !(message1.equals(new Object()));
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(!(message1.equals(new Object()))).isTrue();
|
||||
|
||||
// Equal values are equal
|
||||
message1 = new SimpleMailMessage();
|
||||
|
||||
+3
-6
@@ -66,8 +66,7 @@ class BeanNamePointcutAtAspectTests {
|
||||
|
||||
@Test
|
||||
void matchingBeanName() {
|
||||
boolean condition = testBean1 instanceof Advised;
|
||||
assertThat(condition).as("Expected a proxy").isTrue();
|
||||
assertThat(testBean1 instanceof Advised).as("Expected a proxy").isTrue();
|
||||
|
||||
// Call two methods to test for SPR-3953-like condition
|
||||
testBean1.setAge(20);
|
||||
@@ -77,8 +76,7 @@ class BeanNamePointcutAtAspectTests {
|
||||
|
||||
@Test
|
||||
void nonMatchingBeanName() {
|
||||
boolean condition = testBean3 instanceof Advised;
|
||||
assertThat(condition).as("Didn't expect a proxy").isFalse();
|
||||
assertThat(testBean3 instanceof Advised).as("Didn't expect a proxy").isFalse();
|
||||
|
||||
testBean3.setAge(20);
|
||||
assertThat(counterAspect.count).isEqualTo(0);
|
||||
@@ -96,8 +94,7 @@ class BeanNamePointcutAtAspectTests {
|
||||
|
||||
ITestBean proxyTestBean = factory.getProxy();
|
||||
|
||||
boolean condition = proxyTestBean instanceof Advised;
|
||||
assertThat(condition).as("Expected a proxy").isTrue();
|
||||
assertThat(proxyTestBean instanceof Advised).as("Expected a proxy").isTrue();
|
||||
proxyTestBean.setAge(20);
|
||||
assertThat(myCounterAspect.count).as("Programmatically created proxy shouldn't match bean()").isEqualTo(0);
|
||||
}
|
||||
|
||||
+9
-18
@@ -75,8 +75,7 @@ class BeanNamePointcutTests {
|
||||
|
||||
@Test
|
||||
void matchingBeanName() {
|
||||
boolean condition = this.testBean1 instanceof Advised;
|
||||
assertThat(condition).as("Matching bean must be advised (proxied)").isTrue();
|
||||
assertThat(this.testBean1 instanceof Advised).as("Matching bean must be advised (proxied)").isTrue();
|
||||
// Call two methods to test for SPR-3953-like condition
|
||||
this.testBean1.setAge(20);
|
||||
this.testBean1.setName("");
|
||||
@@ -85,37 +84,31 @@ class BeanNamePointcutTests {
|
||||
|
||||
@Test
|
||||
void nonMatchingBeanName() {
|
||||
boolean condition = this.testBean2 instanceof Advised;
|
||||
assertThat(condition).as("Non-matching bean must *not* be advised (proxied)").isFalse();
|
||||
assertThat(this.testBean2 instanceof Advised).as("Non-matching bean must *not* be advised (proxied)").isFalse();
|
||||
this.testBean2.setAge(20);
|
||||
assertThat(this.counterAspect.getCount()).as("Advice must *not* have been executed").isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void nonMatchingNestedBeanName() {
|
||||
boolean condition = this.testBeanContainingNestedBean.getDoctor() instanceof Advised;
|
||||
assertThat(condition).as("Non-matching bean must *not* be advised (proxied)").isFalse();
|
||||
assertThat(this.testBeanContainingNestedBean.getDoctor() instanceof Advised).as("Non-matching bean must *not* be advised (proxied)").isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void matchingFactoryBeanObject() {
|
||||
boolean condition1 = this.testFactoryBean1 instanceof Advised;
|
||||
assertThat(condition1).as("Matching bean must be advised (proxied)").isTrue();
|
||||
assertThat(this.testFactoryBean1 instanceof Advised).as("Matching bean must be advised (proxied)").isTrue();
|
||||
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);
|
||||
FactoryBean<?> fb = (FactoryBean<?>) ctx.getBean("&testFactoryBean1");
|
||||
boolean condition = !(fb instanceof Advised);
|
||||
assertThat(condition).as("FactoryBean itself must *not* be advised").isTrue();
|
||||
assertThat(!(fb instanceof Advised)).as("FactoryBean itself must *not* be advised").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void matchingFactoryBeanItself() {
|
||||
boolean condition1 = !(this.testFactoryBean2 instanceof Advised);
|
||||
assertThat(condition1).as("Matching bean must *not* be advised (proxied)").isTrue();
|
||||
assertThat(!(this.testFactoryBean2 instanceof Advised)).as("Matching bean must *not* be advised (proxied)").isTrue();
|
||||
FactoryBean<?> fb = (FactoryBean<?>) ctx.getBean("&testFactoryBean2");
|
||||
boolean condition = fb instanceof Advised;
|
||||
assertThat(condition).as("FactoryBean itself must be advised").isTrue();
|
||||
assertThat(fb instanceof Advised).as("FactoryBean itself must be advised").isTrue();
|
||||
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);
|
||||
@@ -123,10 +116,8 @@ class BeanNamePointcutTests {
|
||||
|
||||
@Test
|
||||
void pointcutAdvisorCombination() {
|
||||
boolean condition = this.interceptThis instanceof Advised;
|
||||
assertThat(condition).as("Matching bean must be advised (proxied)").isTrue();
|
||||
boolean condition1 = this.dontInterceptThis instanceof Advised;
|
||||
assertThat(condition1).as("Non-matching bean must *not* be advised (proxied)").isFalse();
|
||||
assertThat(this.interceptThis instanceof Advised).as("Matching bean must be advised (proxied)").isTrue();
|
||||
assertThat(this.dontInterceptThis instanceof Advised).as("Non-matching bean must *not* be advised (proxied)").isFalse();
|
||||
interceptThis.setAge(20);
|
||||
assertThat(testInterceptor.interceptionCount).isEqualTo(1);
|
||||
dontInterceptThis.setAge(20);
|
||||
|
||||
+2
-4
@@ -61,8 +61,7 @@ class PropertyDependentAspectTests {
|
||||
private void checkXmlAspect(String appContextFile) {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(appContextFile, getClass());
|
||||
ICounter counter = (ICounter) context.getBean("counter");
|
||||
boolean condition = counter instanceof Advised;
|
||||
assertThat(condition).as("Proxy didn't get created").isTrue();
|
||||
assertThat(counter instanceof Advised).as("Proxy didn't get created").isTrue();
|
||||
|
||||
counter.increment();
|
||||
JoinPointMonitorAspect callCountingAspect = (JoinPointMonitorAspect)context.getBean("monitoringAspect");
|
||||
@@ -73,8 +72,7 @@ class PropertyDependentAspectTests {
|
||||
private void checkAtAspectJAspect(String appContextFile) {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(appContextFile, getClass());
|
||||
ICounter counter = (ICounter) context.getBean("counter");
|
||||
boolean condition = counter instanceof Advised;
|
||||
assertThat(condition).as("Proxy didn't get created").isTrue();
|
||||
assertThat(counter instanceof Advised).as("Proxy didn't get created").isTrue();
|
||||
|
||||
counter.increment();
|
||||
JoinPointMonitorAtAspectJAspect callCountingAspect = (JoinPointMonitorAtAspectJAspect)context.getBean("monitoringAspect");
|
||||
|
||||
+1
-2
@@ -97,8 +97,7 @@ class MethodLocatingFactoryBeanTests {
|
||||
factory.setBeanFactory(beanFactory);
|
||||
Object result = factory.getObject();
|
||||
assertThat(result).isNotNull();
|
||||
boolean condition = result instanceof Method;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof Method).isTrue();
|
||||
Method method = (Method) result;
|
||||
assertThat(method.invoke("Bingo")).isEqualTo("Bingo");
|
||||
}
|
||||
|
||||
+1
-2
@@ -854,8 +854,7 @@ abstract class AbstractAopProxyTests {
|
||||
assertThat(proxied.getAge()).isEqualTo(10);
|
||||
assertThat(mba.getCalls()).isEqualTo(1);
|
||||
|
||||
boolean condition = proxied instanceof Advised;
|
||||
assertThat(condition).as("Cannot be cast to Advised").isFalse();
|
||||
assertThat(proxied instanceof Advised).as("Cannot be cast to Advised").isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+4
-8
@@ -121,13 +121,11 @@ class CommonsPool2TargetSourceTests {
|
||||
void proxySerializableWithoutConfigMixin() throws Exception {
|
||||
Person pooled = (Person) beanFactory.getBean("pooledPerson");
|
||||
|
||||
boolean condition1 = ((Advised) pooled).getTargetSource() instanceof CommonsPool2TargetSource;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(((Advised) pooled).getTargetSource() instanceof CommonsPool2TargetSource).isTrue();
|
||||
|
||||
//((Advised) pooled).setTargetSource(new SingletonTargetSource(new SerializablePerson()));
|
||||
Person serialized = SerializationTestUtils.serializeAndDeserialize(pooled);
|
||||
boolean condition = ((Advised) serialized).getTargetSource() instanceof SingletonTargetSource;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(((Advised) serialized).getTargetSource() instanceof SingletonTargetSource).isTrue();
|
||||
serialized.setAge(25);
|
||||
assertThat(serialized.getAge()).isEqualTo(25);
|
||||
}
|
||||
@@ -206,10 +204,8 @@ class CommonsPool2TargetSourceTests {
|
||||
|
||||
Object first = targetSource.getTarget();
|
||||
Object second = targetSource.getTarget();
|
||||
boolean condition1 = first instanceof SerializablePerson;
|
||||
assertThat(condition1).isTrue();
|
||||
boolean condition = second instanceof SerializablePerson;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(first instanceof SerializablePerson).isTrue();
|
||||
assertThat(second instanceof SerializablePerson).isTrue();
|
||||
assertThat(second).isEqualTo(first);
|
||||
|
||||
targetSource.releaseTarget(first);
|
||||
|
||||
+1
-2
@@ -79,8 +79,7 @@ class ClassPathFactoryBeanDefinitionScannerTests {
|
||||
|
||||
Object bean = context.getBean("requestScopedInstance"); //5
|
||||
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
|
||||
boolean condition = bean instanceof ScopedObject;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(bean instanceof ScopedObject).isTrue();
|
||||
|
||||
QualifiedClientBean clientBean = context.getBean("clientBean", QualifiedClientBean.class);
|
||||
assertThat(clientBean.testBean).isSameAs(context.getBean("publicInstance"));
|
||||
|
||||
+1
-2
@@ -401,8 +401,7 @@ class CommonAnnotationBeanPostProcessorTests {
|
||||
bf.getBean("annotatedBean2");
|
||||
}
|
||||
catch (BeanCreationException ex) {
|
||||
boolean condition = ex.getRootCause() instanceof NoSuchBeanDefinitionException;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(ex.getRootCause() instanceof NoSuchBeanDefinitionException).isTrue();
|
||||
NoSuchBeanDefinitionException innerEx = (NoSuchBeanDefinitionException) ex.getRootCause();
|
||||
assertThat(innerEx.getBeanName()).isEqualTo("testBean9");
|
||||
}
|
||||
|
||||
+5
-10
@@ -457,8 +457,7 @@ class ConfigurationClassPostProcessorTests {
|
||||
pp.postProcessBeanFactory(beanFactory);
|
||||
|
||||
Foo foo = beanFactory.getBean(Foo.class);
|
||||
boolean condition = foo instanceof ExtendedFoo;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(foo instanceof ExtendedFoo).isTrue();
|
||||
Bar bar = beanFactory.getBean(Bar.class);
|
||||
assertThat(bar.foo).isSameAs(foo);
|
||||
}
|
||||
@@ -473,8 +472,7 @@ class ConfigurationClassPostProcessorTests {
|
||||
pp.postProcessBeanFactory(beanFactory);
|
||||
|
||||
Foo foo = beanFactory.getBean(Foo.class);
|
||||
boolean condition = foo instanceof ExtendedAgainFoo;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(foo instanceof ExtendedAgainFoo).isTrue();
|
||||
Bar bar = beanFactory.getBean(Bar.class);
|
||||
assertThat(bar.foo).isSameAs(foo);
|
||||
}
|
||||
@@ -504,8 +502,7 @@ class ConfigurationClassPostProcessorTests {
|
||||
pp.postProcessBeanFactory(beanFactory);
|
||||
|
||||
Foo foo = beanFactory.getBean(Foo.class);
|
||||
boolean condition = foo instanceof ExtendedFoo;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(foo instanceof ExtendedFoo).isTrue();
|
||||
Bar bar = beanFactory.getBean(Bar.class);
|
||||
assertThat(bar.foo).isSameAs(foo);
|
||||
}
|
||||
@@ -519,8 +516,7 @@ class ConfigurationClassPostProcessorTests {
|
||||
beanFactory.addBeanPostProcessor(new AutowiredAnnotationBeanPostProcessor());
|
||||
|
||||
Foo foo = beanFactory.getBean(Foo.class);
|
||||
boolean condition = foo instanceof ExtendedFoo;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(foo instanceof ExtendedFoo).isTrue();
|
||||
Bar bar = beanFactory.getBean(Bar.class);
|
||||
assertThat(bar.foo).isSameAs(foo);
|
||||
}
|
||||
@@ -536,8 +532,7 @@ class ConfigurationClassPostProcessorTests {
|
||||
pp.postProcessBeanFactory(beanFactory);
|
||||
|
||||
ITestBean injected = beanFactory.getBean("consumer", ScopedProxyConsumer.class).testBean;
|
||||
boolean condition = injected instanceof ScopedObject;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(injected instanceof ScopedObject).isTrue();
|
||||
assertThat(injected).isSameAs(beanFactory.getBean("scopedClass"));
|
||||
assertThat(injected).isSameAs(beanFactory.getBean(ITestBean.class));
|
||||
}
|
||||
|
||||
+1
-2
@@ -44,8 +44,7 @@ class SimpleConfigTests {
|
||||
assertThat(value).isEqualTo("bar");
|
||||
|
||||
Future<?> future = fooService.asyncFoo(1);
|
||||
boolean condition = future instanceof FutureTask;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(future instanceof FutureTask).isTrue();
|
||||
assertThat(future.get()).isEqualTo("bar");
|
||||
|
||||
assertThat(serviceInvocationCounter.getCount()).isEqualTo(2);
|
||||
|
||||
+3
-6
@@ -153,16 +153,14 @@ class ScopingTests {
|
||||
// get hidden bean
|
||||
Object bean = ctx.getBean("scopedTarget." + beanName);
|
||||
|
||||
boolean condition = bean instanceof ScopedObject;
|
||||
assertThat(condition).isFalse();
|
||||
assertThat(bean instanceof ScopedObject).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void scopedProxyConfiguration() {
|
||||
TestBean singleton = (TestBean) ctx.getBean("singletonWithScopedInterfaceDep");
|
||||
ITestBean spouse = singleton.getSpouse();
|
||||
boolean condition = spouse instanceof ScopedObject;
|
||||
assertThat(condition).as("scoped bean is not wrapped by the scoped-proxy").isTrue();
|
||||
assertThat(spouse instanceof ScopedObject).as("scoped bean is not wrapped by the scoped-proxy").isTrue();
|
||||
|
||||
String beanName = "scopedProxyInterface";
|
||||
|
||||
@@ -194,8 +192,7 @@ class ScopingTests {
|
||||
void scopedProxyConfigurationWithClasses() {
|
||||
TestBean singleton = (TestBean) ctx.getBean("singletonWithScopedClassDep");
|
||||
ITestBean spouse = singleton.getSpouse();
|
||||
boolean condition = spouse instanceof ScopedObject;
|
||||
assertThat(condition).as("scoped bean is not wrapped by the scoped-proxy").isTrue();
|
||||
assertThat(spouse instanceof ScopedObject).as("scoped bean is not wrapped by the scoped-proxy").isTrue();
|
||||
|
||||
String beanName = "scopedProxyClass";
|
||||
|
||||
|
||||
+10
-20
@@ -67,15 +67,13 @@ class LocaleContextHolderTests {
|
||||
LocaleContextHolder.setLocale(Locale.GERMAN);
|
||||
assertThat(LocaleContextHolder.getLocale()).isEqualTo(Locale.GERMAN);
|
||||
assertThat(LocaleContextHolder.getTimeZone()).isEqualTo(TimeZone.getDefault());
|
||||
boolean condition1 = LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition1).isFalse();
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isFalse();
|
||||
assertThat(LocaleContextHolder.getLocaleContext().getLocale()).isEqualTo(Locale.GERMAN);
|
||||
|
||||
LocaleContextHolder.setLocale(Locale.GERMANY);
|
||||
assertThat(LocaleContextHolder.getLocale()).isEqualTo(Locale.GERMANY);
|
||||
assertThat(LocaleContextHolder.getTimeZone()).isEqualTo(TimeZone.getDefault());
|
||||
boolean condition = LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition).isFalse();
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isFalse();
|
||||
assertThat(LocaleContextHolder.getLocaleContext().getLocale()).isEqualTo(Locale.GERMANY);
|
||||
|
||||
LocaleContextHolder.setLocale(null);
|
||||
@@ -94,16 +92,14 @@ class LocaleContextHolderTests {
|
||||
LocaleContextHolder.setTimeZone(TimeZone.getTimeZone("GMT+1"));
|
||||
assertThat(LocaleContextHolder.getLocale()).isEqualTo(Locale.getDefault());
|
||||
assertThat(LocaleContextHolder.getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+1"));
|
||||
boolean condition1 = LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
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"));
|
||||
boolean condition = LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext().getLocale()).isNull();
|
||||
assertThat(((TimeZoneAwareLocaleContext) LocaleContextHolder.getLocaleContext()).getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+2"));
|
||||
|
||||
@@ -123,46 +119,40 @@ class LocaleContextHolderTests {
|
||||
LocaleContextHolder.setLocale(Locale.GERMANY);
|
||||
assertThat(LocaleContextHolder.getLocale()).isEqualTo(Locale.GERMANY);
|
||||
assertThat(LocaleContextHolder.getTimeZone()).isEqualTo(TimeZone.getDefault());
|
||||
boolean condition5 = LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition5).isFalse();
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isFalse();
|
||||
assertThat(LocaleContextHolder.getLocaleContext().getLocale()).isEqualTo(Locale.GERMANY);
|
||||
|
||||
LocaleContextHolder.setTimeZone(TimeZone.getTimeZone("GMT+1"));
|
||||
assertThat(LocaleContextHolder.getLocale()).isEqualTo(Locale.GERMANY);
|
||||
assertThat(LocaleContextHolder.getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+1"));
|
||||
boolean condition3 = LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition3).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
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"));
|
||||
boolean condition2 = LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition2).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext().getLocale()).isEqualTo(Locale.GERMAN);
|
||||
assertThat(((TimeZoneAwareLocaleContext) LocaleContextHolder.getLocaleContext()).getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+1"));
|
||||
|
||||
LocaleContextHolder.setTimeZone(null);
|
||||
assertThat(LocaleContextHolder.getLocale()).isEqualTo(Locale.GERMAN);
|
||||
assertThat(LocaleContextHolder.getTimeZone()).isEqualTo(TimeZone.getDefault());
|
||||
boolean condition4 = LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition4).isFalse();
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isFalse();
|
||||
assertThat(LocaleContextHolder.getLocaleContext().getLocale()).isEqualTo(Locale.GERMAN);
|
||||
|
||||
LocaleContextHolder.setTimeZone(TimeZone.getTimeZone("GMT+2"));
|
||||
assertThat(LocaleContextHolder.getLocale()).isEqualTo(Locale.GERMAN);
|
||||
assertThat(LocaleContextHolder.getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+2"));
|
||||
boolean condition1 = LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
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"));
|
||||
boolean condition = LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext() instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
assertThat(LocaleContextHolder.getLocaleContext().getLocale()).isNull();
|
||||
assertThat(((TimeZoneAwareLocaleContext) LocaleContextHolder.getLocaleContext()).getTimeZone()).isEqualTo(TimeZone.getTimeZone("GMT+2"));
|
||||
|
||||
|
||||
+3
-6
@@ -53,22 +53,19 @@ class JeeNamespaceHandlerEventTests {
|
||||
@Test
|
||||
void jndiLookupComponentEventReceived() {
|
||||
ComponentDefinition component = this.eventListener.getComponentDefinition("simple");
|
||||
boolean condition = component instanceof BeanComponentDefinition;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(component instanceof BeanComponentDefinition).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void localSlsbComponentEventReceived() {
|
||||
ComponentDefinition component = this.eventListener.getComponentDefinition("simpleLocalEjb");
|
||||
boolean condition = component instanceof BeanComponentDefinition;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(component instanceof BeanComponentDefinition).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void remoteSlsbComponentEventReceived() {
|
||||
ComponentDefinition component = this.eventListener.getComponentDefinition("simpleRemoteEjb");
|
||||
boolean condition = component instanceof BeanComponentDefinition;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(component instanceof BeanComponentDefinition).isTrue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-4
@@ -86,8 +86,7 @@ class ModelMBeanNotificationPublisherTests {
|
||||
publisher.sendNotification(notification);
|
||||
|
||||
assertThat(mbean.getActualNotification()).isNotNull();
|
||||
boolean condition = mbean.getActualNotification() instanceof AttributeChangeNotification;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(mbean.getActualNotification() instanceof AttributeChangeNotification).isTrue();
|
||||
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);
|
||||
}
|
||||
@@ -102,8 +101,7 @@ class ModelMBeanNotificationPublisherTests {
|
||||
publisher.sendNotification(notification);
|
||||
|
||||
assertThat(mbean.getActualNotification()).isNotNull();
|
||||
boolean condition = mbean.getActualNotification() instanceof AttributeChangeNotification;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(mbean.getActualNotification() instanceof AttributeChangeNotification).isTrue();
|
||||
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
-12
@@ -210,8 +210,7 @@ class JndiObjectFactoryBeanTests {
|
||||
jof.setJndiName("foo");
|
||||
jof.setProxyInterface(ITestBean.class);
|
||||
jof.afterPropertiesSet();
|
||||
boolean condition = jof.getObject() instanceof ITestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(jof.getObject() instanceof ITestBean).isTrue();
|
||||
ITestBean proxy = (ITestBean) jof.getObject();
|
||||
assertThat(tb.getAge()).isEqualTo(0);
|
||||
proxy.setAge(99);
|
||||
@@ -247,8 +246,7 @@ class JndiObjectFactoryBeanTests {
|
||||
jof.setProxyInterface(ITestBean.class);
|
||||
jof.setLookupOnStartup(false);
|
||||
jof.afterPropertiesSet();
|
||||
boolean condition = jof.getObject() instanceof ITestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(jof.getObject() instanceof ITestBean).isTrue();
|
||||
ITestBean proxy = (ITestBean) jof.getObject();
|
||||
assertThat(tb.getName()).isNull();
|
||||
assertThat(tb.getAge()).isEqualTo(0);
|
||||
@@ -276,8 +274,7 @@ class JndiObjectFactoryBeanTests {
|
||||
jof.setProxyInterface(ITestBean.class);
|
||||
jof.setCache(false);
|
||||
jof.afterPropertiesSet();
|
||||
boolean condition = jof.getObject() instanceof ITestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(jof.getObject() instanceof ITestBean).isTrue();
|
||||
ITestBean proxy = (ITestBean) jof.getObject();
|
||||
assertThat(tb.getName()).isEqualTo("tb");
|
||||
assertThat(tb.getAge()).isEqualTo(1);
|
||||
@@ -307,8 +304,7 @@ class JndiObjectFactoryBeanTests {
|
||||
jof.setLookupOnStartup(false);
|
||||
jof.setCache(false);
|
||||
jof.afterPropertiesSet();
|
||||
boolean condition = jof.getObject() instanceof ITestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(jof.getObject() instanceof ITestBean).isTrue();
|
||||
ITestBean proxy = (ITestBean) jof.getObject();
|
||||
assertThat(tb.getName()).isNull();
|
||||
assertThat(tb.getAge()).isEqualTo(0);
|
||||
@@ -347,8 +343,7 @@ class JndiObjectFactoryBeanTests {
|
||||
jof.setExpectedType(TestBean.class);
|
||||
jof.setProxyInterface(ITestBean.class);
|
||||
jof.afterPropertiesSet();
|
||||
boolean condition = jof.getObject() instanceof ITestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(jof.getObject() instanceof ITestBean).isTrue();
|
||||
ITestBean proxy = (ITestBean) jof.getObject();
|
||||
assertThat(tb.getAge()).isEqualTo(0);
|
||||
proxy.setAge(99);
|
||||
@@ -384,8 +379,7 @@ class JndiObjectFactoryBeanTests {
|
||||
jof.setProxyInterface(ITestBean.class);
|
||||
jof.setExposeAccessContext(true);
|
||||
jof.afterPropertiesSet();
|
||||
boolean condition = jof.getObject() instanceof ITestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(jof.getObject() instanceof ITestBean).isTrue();
|
||||
ITestBean proxy = (ITestBean) jof.getObject();
|
||||
assertThat(tb.getAge()).isEqualTo(0);
|
||||
proxy.setAge(99);
|
||||
|
||||
+1
-2
@@ -331,8 +331,7 @@ class ScheduledAnnotationBeanPostProcessorTests {
|
||||
assertThat(task.getExpression()).isEqualTo("0 0 0-4,6-23 * * ?");
|
||||
Trigger trigger = task.getTrigger();
|
||||
assertThat(trigger).isNotNull();
|
||||
boolean condition = trigger instanceof CronTrigger;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(trigger instanceof CronTrigger).isTrue();
|
||||
CronTrigger cronTrigger = (CronTrigger) trigger;
|
||||
ZonedDateTime dateTime = ZonedDateTime.of(2013, 4, 15, 4, 0, 0, 0, ZoneId.of("GMT+10"));
|
||||
Instant lastScheduledExecution = dateTime.toInstant();
|
||||
|
||||
+2
-4
@@ -93,8 +93,7 @@ public abstract class AbstractApplicationContextTests extends AbstractListableBe
|
||||
assertThat(aca.getApplicationContext()).as("has had context set").isSameAs(applicationContext);
|
||||
Object aca2 = applicationContext.getBean("aca-prototype");
|
||||
assertThat(aca).as("NOT Same instance").isNotSameAs(aca2);
|
||||
boolean condition = !applicationContext.isSingleton("aca-prototype");
|
||||
assertThat(condition).as("Says is prototype").isTrue();
|
||||
assertThat(!applicationContext.isSingleton("aca-prototype")).as("Says is prototype").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -128,8 +127,7 @@ public abstract class AbstractApplicationContextTests extends AbstractListableBe
|
||||
@Test
|
||||
protected void closeTriggersDestroy() {
|
||||
LifecycleBean lb = (LifecycleBean) applicationContext.getBean("lifecycle");
|
||||
boolean condition = !lb.isDestroyed();
|
||||
assertThat(condition).as("Not destroyed").isTrue();
|
||||
assertThat(!lb.isDestroyed()).as("Not destroyed").isTrue();
|
||||
applicationContext.close();
|
||||
if (applicationContext.getParent() != null) {
|
||||
((ConfigurableApplicationContext) applicationContext.getParent()).close();
|
||||
|
||||
+1
-2
@@ -643,8 +643,7 @@ class AnnotatedElementUtilsTests {
|
||||
}
|
||||
}
|
||||
assertThat(bridgeMethod != null && bridgeMethod.isBridge()).isTrue();
|
||||
boolean condition = bridgedMethod != null && !bridgedMethod.isBridge();
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(bridgedMethod != null && !bridgedMethod.isBridge()).isTrue();
|
||||
|
||||
AnnotationAttributes attributes = findMergedAnnotationAttributes(bridgeMethod, Order.class);
|
||||
assertThat(attributes).as("Should find @Order on StringGenericParameter.getFor() bridge method").isNotNull();
|
||||
|
||||
+1
-2
@@ -184,8 +184,7 @@ class CollectionToCollectionConverterTests {
|
||||
private void testCollectionConversionToArrayList(Collection<String> aSource) {
|
||||
Object myConverted = (new CollectionToCollectionConverter(new GenericConversionService())).convert(
|
||||
aSource, TypeDescriptor.forObject(aSource), TypeDescriptor.forObject(new ArrayList()));
|
||||
boolean condition = myConverted instanceof ArrayList<?>;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(myConverted instanceof ArrayList<?>).isTrue();
|
||||
assertThat(((ArrayList<?>) myConverted)).hasSameSizeAs(aSource);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +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();
|
||||
boolean condition = element instanceof TestObject;
|
||||
assertThat(condition).as("Element is incorrect type").isTrue();
|
||||
assertThat(element instanceof TestObject).as("Element is incorrect type").isTrue();
|
||||
assertThat(element).isNotSameAs(lastElement);
|
||||
lastElement = element;
|
||||
}
|
||||
@@ -68,14 +67,10 @@ class AutoPopulatingListTests {
|
||||
list.add(11, helloWorld);
|
||||
assertThat(list).element(11, InstanceOfAssertFactories.STRING).isEqualTo(helloWorld);
|
||||
|
||||
boolean condition3 = list.get(10) instanceof TestObject;
|
||||
assertThat(condition3).isTrue();
|
||||
boolean condition2 = list.get(12) instanceof TestObject;
|
||||
assertThat(condition2).isTrue();
|
||||
boolean condition1 = list.get(13) instanceof TestObject;
|
||||
assertThat(condition1).isTrue();
|
||||
boolean condition = list.get(20) instanceof TestObject;
|
||||
assertThat(condition).isTrue();
|
||||
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();
|
||||
}
|
||||
|
||||
private void doTestWithElementFactory(AutoPopulatingList<Object> list) {
|
||||
|
||||
@@ -117,8 +117,7 @@ class JdbcTemplateTests {
|
||||
assertThat(this.template.getDataSource()).as("datasource ok").isSameAs(this.dataSource);
|
||||
assertThat(this.template.isIgnoreWarnings()).as("ignores warnings by default").isTrue();
|
||||
this.template.setIgnoreWarnings(false);
|
||||
boolean condition = !this.template.isIgnoreWarnings();
|
||||
assertThat(condition).as("can set NOT to ignore warnings").isTrue();
|
||||
assertThat(!this.template.isIgnoreWarnings()).as("can set NOT to ignore warnings").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1126,8 +1125,7 @@ class JdbcTemplateTests {
|
||||
given(this.callableStatement.getUpdateCount()).willReturn(-1);
|
||||
given(this.callableStatement.getObject(1)).willReturn("X");
|
||||
|
||||
boolean condition = !this.template.isResultsMapCaseInsensitive();
|
||||
assertThat(condition).as("default should have been NOT case insensitive").isTrue();
|
||||
assertThat(!this.template.isResultsMapCaseInsensitive()).as("default should have been NOT case insensitive").isTrue();
|
||||
|
||||
this.template.setResultsMapCaseInsensitive(true);
|
||||
assertThat(this.template.isResultsMapCaseInsensitive()).as("now it should have been set to case insensitive").isTrue();
|
||||
|
||||
+1
-2
@@ -94,8 +94,7 @@ class CallMetaDataContextTests {
|
||||
assertThat(inParameters).as("Wrong number of matched in parameter values").hasSize(2);
|
||||
assertThat(inParameters.containsKey("id")).as("in parameter value missing").isTrue();
|
||||
assertThat(inParameters.containsKey("name")).as("in out parameter value missing").isTrue();
|
||||
boolean condition = !inParameters.containsKey("customer_no");
|
||||
assertThat(condition).as("out parameter value matched").isTrue();
|
||||
assertThat(!inParameters.containsKey("customer_no")).as("out parameter value matched").isTrue();
|
||||
|
||||
List<String> names = context.getOutParameterNames();
|
||||
assertThat(names).as("Wrong number of out parameters").hasSize(2);
|
||||
|
||||
+4
-8
@@ -104,14 +104,10 @@ class TableMetaDataContextTests {
|
||||
List<Object> values = context.matchInParameterValuesWithInsertColumns(map);
|
||||
|
||||
assertThat(values.size()).as("wrong number of parameters: ").isEqualTo(4);
|
||||
boolean condition3 = values.get(0) instanceof Number;
|
||||
assertThat(condition3).as("id not wrapped with type info").isTrue();
|
||||
boolean condition2 = values.get(1) instanceof String;
|
||||
assertThat(condition2).as("name not wrapped with type info").isTrue();
|
||||
boolean condition1 = values.get(2) instanceof SqlParameterValue;
|
||||
assertThat(condition1).as("date wrapped with type info").isTrue();
|
||||
boolean condition = values.get(3) instanceof SqlParameterValue;
|
||||
assertThat(condition).as("version wrapped with type info").isTrue();
|
||||
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();
|
||||
verify(metaDataResultSet, atLeastOnce()).next();
|
||||
verify(columnsResultSet, atLeastOnce()).next();
|
||||
verify(metaDataResultSet).close();
|
||||
|
||||
+2
-4
@@ -107,8 +107,7 @@ class JmsListenerAnnotationBeanPostProcessorTests {
|
||||
assertThat(endpoint.getClass()).as("Wrong endpoint type").isEqualTo(MethodJmsListenerEndpoint.class);
|
||||
MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
|
||||
assertThat(AopUtils.isJdkDynamicProxy(methodEndpoint.getBean())).isTrue();
|
||||
boolean condition = methodEndpoint.getBean() instanceof SimpleService;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(methodEndpoint.getBean() instanceof SimpleService).isTrue();
|
||||
assertThat(methodEndpoint.getMethod()).isEqualTo(SimpleService.class.getMethod("handleIt", String.class, String.class));
|
||||
assertThat(methodEndpoint.getMostSpecificMethod()).isEqualTo(InterfaceProxyTestBean.class.getMethod("handleIt", String.class, String.class));
|
||||
|
||||
@@ -129,8 +128,7 @@ class JmsListenerAnnotationBeanPostProcessorTests {
|
||||
assertThat(endpoint.getClass()).as("Wrong endpoint type").isEqualTo(MethodJmsListenerEndpoint.class);
|
||||
MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint;
|
||||
assertThat(AopUtils.isCglibProxy(methodEndpoint.getBean())).isTrue();
|
||||
boolean condition = methodEndpoint.getBean() instanceof ClassProxyTestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(methodEndpoint.getBean() instanceof ClassProxyTestBean).isTrue();
|
||||
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
-4
@@ -170,8 +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();
|
||||
boolean condition = ex instanceof ListenerExecutionFailedException;
|
||||
assertThat(condition).as("The Throwable passed to the handleListenerException(..) method must be of type [ListenerExecutionFailedException].").isTrue();
|
||||
assertThat(ex instanceof ListenerExecutionFailedException).as("The Throwable passed to the handleListenerException(..) method must be of type [ListenerExecutionFailedException].").isTrue();
|
||||
ListenerExecutionFailedException lefx = (ListenerExecutionFailedException) ex;
|
||||
Throwable cause = lefx.getCause();
|
||||
assertThat(cause).as("The cause of a ListenerExecutionFailedException must be preserved.").isNotNull();
|
||||
@@ -187,8 +186,7 @@ class MessageListenerAdapterTests {
|
||||
void thatTheDefaultMessageConverterisIndeedTheSimpleMessageConverter() {
|
||||
MessageListenerAdapter adapter = new MessageListenerAdapter();
|
||||
assertThat(adapter.getMessageConverter()).as("The default [MessageConverter] must never be null.").isNotNull();
|
||||
boolean condition = adapter.getMessageConverter() instanceof SimpleMessageConverter;
|
||||
assertThat(condition).as("The default [MessageConverter] must be of the type [SimpleMessageConverter]").isTrue();
|
||||
assertThat(adapter.getMessageConverter() instanceof SimpleMessageConverter).as("The default [MessageConverter] must be of the type [SimpleMessageConverter]").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+4
-8
@@ -67,8 +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);
|
||||
|
||||
boolean condition = resolved instanceof Map;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(resolved instanceof Map).isTrue();
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> headers = (Map<String, Object>) resolved;
|
||||
assertThat(headers.get("foo")).isEqualTo("bar");
|
||||
@@ -84,8 +83,7 @@ class HeadersMethodArgumentResolverTests {
|
||||
void resolveArgumentMessageHeaders() throws Exception {
|
||||
Object resolved = this.resolver.resolveArgument(this.resolvable.arg(MessageHeaders.class), this.message);
|
||||
|
||||
boolean condition = resolved instanceof MessageHeaders;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(resolved instanceof MessageHeaders).isTrue();
|
||||
MessageHeaders headers = (MessageHeaders) resolved;
|
||||
assertThat(headers.get("foo")).isEqualTo("bar");
|
||||
}
|
||||
@@ -95,8 +93,7 @@ class HeadersMethodArgumentResolverTests {
|
||||
MethodParameter param = this.resolvable.arg(MessageHeaderAccessor.class);
|
||||
Object resolved = this.resolver.resolveArgument(param, this.message);
|
||||
|
||||
boolean condition = resolved instanceof MessageHeaderAccessor;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(resolved instanceof MessageHeaderAccessor).isTrue();
|
||||
MessageHeaderAccessor headers = (MessageHeaderAccessor) resolved;
|
||||
assertThat(headers.getHeader("foo")).isEqualTo("bar");
|
||||
}
|
||||
@@ -106,8 +103,7 @@ class HeadersMethodArgumentResolverTests {
|
||||
MethodParameter param = this.resolvable.arg(TestMessageHeaderAccessor.class);
|
||||
Object resolved = this.resolver.resolveArgument(param, this.message);
|
||||
|
||||
boolean condition = resolved instanceof TestMessageHeaderAccessor;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(resolved instanceof TestMessageHeaderAccessor).isTrue();
|
||||
TestMessageHeaderAccessor headers = (TestMessageHeaderAccessor) resolved;
|
||||
assertThat(headers.getHeader("foo")).isEqualTo("bar");
|
||||
}
|
||||
|
||||
+2
-4
@@ -226,11 +226,9 @@ class MessageMethodArgumentResolverTests {
|
||||
this.resolver = new MessageMethodArgumentResolver(new MappingJackson2MessageConverter());
|
||||
Object actual = this.resolver.resolveArgument(parameter, inMessage);
|
||||
|
||||
boolean condition1 = actual instanceof Message;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(actual instanceof Message).isTrue();
|
||||
Message<?> outMessage = (Message<?>) actual;
|
||||
boolean condition = outMessage.getPayload() instanceof Foo;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(outMessage.getPayload() instanceof Foo).isTrue();
|
||||
assertThat(((Foo) outMessage.getPayload()).getFoo()).isEqualTo("bar");
|
||||
}
|
||||
|
||||
|
||||
@@ -96,8 +96,7 @@ public abstract class AbstractMarshallerTests<M extends Marshaller> {
|
||||
DocumentBuilder builder = documentBuilderFactory.newDocumentBuilder();
|
||||
DOMResult domResult = new DOMResult();
|
||||
marshaller.marshal(flights, domResult);
|
||||
boolean condition = domResult.getNode() instanceof Document;
|
||||
assertThat(condition).as("DOMResult does not contain a Document").isTrue();
|
||||
assertThat(domResult.getNode() instanceof Document).as("DOMResult does not contain a Document").isTrue();
|
||||
Document result = (Document) domResult.getNode();
|
||||
Document expected = builder.newDocument();
|
||||
Element flightsElement = expected.createElementNS("http://samples.springframework.org/flight", "tns:flights");
|
||||
|
||||
+6
-12
@@ -91,23 +91,20 @@ class JndiJtaTransactionManagerTests {
|
||||
assertThat(ptm.getUserTransaction()).isEqualTo(ut);
|
||||
}
|
||||
else {
|
||||
boolean condition = ptm.getUserTransaction() instanceof UserTransactionAdapter;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(ptm.getUserTransaction() instanceof UserTransactionAdapter).isTrue();
|
||||
UserTransactionAdapter uta = (UserTransactionAdapter) ptm.getUserTransaction();
|
||||
assertThat(uta.getTransactionManager()).isEqualTo(tm);
|
||||
}
|
||||
|
||||
TransactionTemplate tt = new TransactionTemplate(ptm);
|
||||
boolean condition1 = !TransactionSynchronizationManager.isSynchronizationActive();
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(!TransactionSynchronizationManager.isSynchronizationActive()).isTrue();
|
||||
assertThat(TransactionSynchronizationManager.isCurrentTransactionReadOnly()).isFalse();
|
||||
tt.executeWithoutResult(status -> {
|
||||
// something transactional
|
||||
assertThat(TransactionSynchronizationManager.isSynchronizationActive()).isTrue();
|
||||
assertThat(TransactionSynchronizationManager.isCurrentTransactionReadOnly()).isFalse();
|
||||
});
|
||||
boolean condition = !TransactionSynchronizationManager.isSynchronizationActive();
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(!TransactionSynchronizationManager.isSynchronizationActive()).isTrue();
|
||||
assertThat(TransactionSynchronizationManager.isCurrentTransactionReadOnly()).isFalse();
|
||||
|
||||
|
||||
@@ -142,16 +139,14 @@ class JndiJtaTransactionManagerTests {
|
||||
assertThat(ptm.getTransactionManager()).isEqualTo(tm);
|
||||
|
||||
TransactionTemplate tt = new TransactionTemplate(ptm);
|
||||
boolean condition1 = !TransactionSynchronizationManager.isSynchronizationActive();
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(!TransactionSynchronizationManager.isSynchronizationActive()).isTrue();
|
||||
assertThat(TransactionSynchronizationManager.isCurrentTransactionReadOnly()).isFalse();
|
||||
tt.executeWithoutResult(status -> {
|
||||
// something transactional
|
||||
assertThat(TransactionSynchronizationManager.isSynchronizationActive()).isTrue();
|
||||
assertThat(TransactionSynchronizationManager.isCurrentTransactionReadOnly()).isFalse();
|
||||
});
|
||||
boolean condition = !TransactionSynchronizationManager.isSynchronizationActive();
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(!TransactionSynchronizationManager.isSynchronizationActive()).isTrue();
|
||||
assertThat(TransactionSynchronizationManager.isCurrentTransactionReadOnly()).isFalse();
|
||||
|
||||
verify(ut).begin();
|
||||
@@ -175,8 +170,7 @@ class JndiJtaTransactionManagerTests {
|
||||
|
||||
TransactionTemplate tt = new TransactionTemplate(ptm);
|
||||
assertThat(ptm.getTransactionSynchronization()).isEqualTo(JtaTransactionManager.SYNCHRONIZATION_ALWAYS);
|
||||
boolean condition1 = !TransactionSynchronizationManager.isSynchronizationActive();
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(!TransactionSynchronizationManager.isSynchronizationActive()).isTrue();
|
||||
assertThat(TransactionSynchronizationManager.isCurrentTransactionReadOnly()).isFalse();
|
||||
tt.executeWithoutResult(status -> {
|
||||
// something transactional
|
||||
|
||||
+4
-8
@@ -204,8 +204,7 @@ class ServletRequestDataBinderTests {
|
||||
request.addParameter("test_age", "" + 50);
|
||||
|
||||
ServletRequestParameterPropertyValues pvs = new ServletRequestParameterPropertyValues(request);
|
||||
boolean condition = !pvs.contains("forname");
|
||||
assertThat(condition).as("Didn't find normal when given prefix").isTrue();
|
||||
assertThat(!pvs.contains("forname")).as("Didn't find normal when given prefix").isTrue();
|
||||
assertThat(pvs.contains("test_forname")).as("Did treat prefix as normal when not given prefix").isTrue();
|
||||
|
||||
pvs = new ServletRequestParameterPropertyValues(request, "test");
|
||||
@@ -227,8 +226,7 @@ class ServletRequestDataBinderTests {
|
||||
|
||||
ServletRequestParameterPropertyValues pvs = new ServletRequestParameterPropertyValues(request);
|
||||
assertThat(pvs.getPropertyValues().length).as("Found 1 parameter").isEqualTo(1);
|
||||
boolean condition = pvs.getPropertyValue("forname").getValue() instanceof String[];
|
||||
assertThat(condition).as("Found array value").isTrue();
|
||||
assertThat(pvs.getPropertyValue("forname").getValue() instanceof String[]).as("Found array value").isTrue();
|
||||
String[] values = (String[]) pvs.getPropertyValue("forname").getValue();
|
||||
assertThat(Arrays.asList(original)).as("Correct values").isEqualTo(Arrays.asList(values));
|
||||
}
|
||||
@@ -241,8 +239,7 @@ class ServletRequestDataBinderTests {
|
||||
assertThat(pvs.contains("forname")).as("Contains forname").isTrue();
|
||||
assertThat(pvs.contains("surname")).as("Contains surname").isTrue();
|
||||
assertThat(pvs.contains("age")).as("Contains age").isTrue();
|
||||
boolean condition1 = !pvs.contains("tory");
|
||||
assertThat(condition1).as("Doesn't contain tory").isTrue();
|
||||
assertThat(!pvs.contains("tory")).as("Doesn't contain tory").isTrue();
|
||||
|
||||
PropertyValue[] ps = pvs.getPropertyValues();
|
||||
Map<String, String> m = new HashMap<>();
|
||||
@@ -252,8 +249,7 @@ class ServletRequestDataBinderTests {
|
||||
for (PropertyValue element : ps) {
|
||||
Object val = m.get(element.getName());
|
||||
assertThat(val).as("Can't have unexpected value").isNotNull();
|
||||
boolean condition = val instanceof String;
|
||||
assertThat(condition).as("Val i string").isTrue();
|
||||
assertThat(val instanceof String).as("Val i string").isTrue();
|
||||
assertThat(val.equals(element.getValue())).as("val matches expected").isTrue();
|
||||
m.remove(element.getName());
|
||||
}
|
||||
|
||||
+4
-8
@@ -307,8 +307,7 @@ class WebRequestDataBinderTests {
|
||||
request.addParameter("test_age", "" + 50);
|
||||
|
||||
ServletRequestParameterPropertyValues pvs = new ServletRequestParameterPropertyValues(request);
|
||||
boolean condition = !pvs.contains("forname");
|
||||
assertThat(condition).as("Didn't find normal when given prefix").isTrue();
|
||||
assertThat(!pvs.contains("forname")).as("Didn't find normal when given prefix").isTrue();
|
||||
assertThat(pvs.contains("test_forname")).as("Did treat prefix as normal when not given prefix").isTrue();
|
||||
|
||||
pvs = new ServletRequestParameterPropertyValues(request, "test");
|
||||
@@ -323,8 +322,7 @@ class WebRequestDataBinderTests {
|
||||
assertThat(pvs.contains("forname")).as("Contains forname").isTrue();
|
||||
assertThat(pvs.contains("surname")).as("Contains surname").isTrue();
|
||||
assertThat(pvs.contains("age")).as("Contains age").isTrue();
|
||||
boolean condition1 = !pvs.contains("tory");
|
||||
assertThat(condition1).as("Doesn't contain tory").isTrue();
|
||||
assertThat(!pvs.contains("tory")).as("Doesn't contain tory").isTrue();
|
||||
|
||||
PropertyValue[] pvArray = pvs.getPropertyValues();
|
||||
Map<String, String> m = new HashMap<>();
|
||||
@@ -334,8 +332,7 @@ class WebRequestDataBinderTests {
|
||||
for (PropertyValue pv : pvArray) {
|
||||
Object val = m.get(pv.getName());
|
||||
assertThat(val).as("Can't have unexpected value").isNotNull();
|
||||
boolean condition = val instanceof String;
|
||||
assertThat(condition).as("Val i string").isTrue();
|
||||
assertThat(val instanceof String).as("Val i string").isTrue();
|
||||
assertThat(val.equals(pv.getValue())).as("val matches expected").isTrue();
|
||||
m.remove(pv.getName());
|
||||
}
|
||||
@@ -357,8 +354,7 @@ class WebRequestDataBinderTests {
|
||||
|
||||
ServletRequestParameterPropertyValues pvs = new ServletRequestParameterPropertyValues(request);
|
||||
assertThat(pvs.getPropertyValues().length).as("Found 1 parameter").isEqualTo(1);
|
||||
boolean condition = pvs.getPropertyValue("forname").getValue() instanceof String[];
|
||||
assertThat(condition).as("Found array value").isTrue();
|
||||
assertThat(pvs.getPropertyValue("forname").getValue() instanceof String[]).as("Found array value").isTrue();
|
||||
String[] values = (String[]) pvs.getPropertyValue("forname").getValue();
|
||||
assertThat(Arrays.asList(original)).as("Correct values").isEqualTo(Arrays.asList(values));
|
||||
}
|
||||
|
||||
+2
-4
@@ -55,8 +55,7 @@ class ContextLoaderInitializerTests {
|
||||
void register() throws ServletException {
|
||||
initializer.onStartup(servletContext);
|
||||
|
||||
boolean condition1 = eventListener instanceof ContextLoaderListener;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(eventListener instanceof ContextLoaderListener).isTrue();
|
||||
ContextLoaderListener cll = (ContextLoaderListener) eventListener;
|
||||
cll.contextInitialized(new ServletContextEvent(servletContext));
|
||||
|
||||
@@ -64,8 +63,7 @@ class ContextLoaderInitializerTests {
|
||||
.getRequiredWebApplicationContext(servletContext);
|
||||
|
||||
assertThat(applicationContext.containsBean(BEAN_NAME)).isTrue();
|
||||
boolean condition = applicationContext.getBean(BEAN_NAME) instanceof MyBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(applicationContext.getBean(BEAN_NAME) instanceof MyBean).isTrue();
|
||||
}
|
||||
|
||||
private class MyMockServletContext extends MockServletContext {
|
||||
|
||||
+1
-2
@@ -104,8 +104,7 @@ class RequestScopeTests {
|
||||
String name = "requestScopedFactoryBean";
|
||||
assertThat(request.getAttribute(name)).isNull();
|
||||
TestBean bean = (TestBean) this.beanFactory.getBean(name);
|
||||
boolean condition = request.getAttribute(name) instanceof FactoryBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(request.getAttribute(name) instanceof FactoryBean).isTrue();
|
||||
assertThat(this.beanFactory.getBean(name)).isSameAs(bean);
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -50,8 +50,7 @@ class SpringBeanAutowiringSupportTests {
|
||||
|
||||
InjectionTarget target = new InjectionTarget();
|
||||
SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(target, sc);
|
||||
boolean condition = target.testBean instanceof TestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(target.testBean instanceof TestBean).isTrue();
|
||||
assertThat(target.name).isEqualTo("tb");
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -80,8 +80,7 @@ class CookieValueMethodArgumentResolverTests {
|
||||
void resolveCookieDefaultValue() throws Exception {
|
||||
Object result = resolver.resolveArgument(paramNamedDefaultValueString, null, webRequest, null);
|
||||
|
||||
boolean condition = result instanceof String;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof String).isTrue();
|
||||
assertThat(result).as("Invalid result").isEqualTo("bar");
|
||||
}
|
||||
|
||||
|
||||
+3
-6
@@ -91,8 +91,7 @@ class RequestHeaderMapMethodArgumentResolverTests {
|
||||
|
||||
Object result = resolver.resolveArgument(paramMap, null, webRequest, null);
|
||||
|
||||
boolean condition = result instanceof Map;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof Map).isTrue();
|
||||
assertThat(result).as("Invalid result").isEqualTo(expected);
|
||||
}
|
||||
|
||||
@@ -111,8 +110,7 @@ class RequestHeaderMapMethodArgumentResolverTests {
|
||||
|
||||
Object result = resolver.resolveArgument(paramMultiValueMap, null, webRequest, null);
|
||||
|
||||
boolean condition = result instanceof MultiValueMap;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof MultiValueMap).isTrue();
|
||||
assertThat(result).as("Invalid result").isEqualTo(expected);
|
||||
}
|
||||
|
||||
@@ -131,8 +129,7 @@ class RequestHeaderMapMethodArgumentResolverTests {
|
||||
|
||||
Object result = resolver.resolveArgument(paramHttpHeaders, null, webRequest, null);
|
||||
|
||||
boolean condition = result instanceof HttpHeaders;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof HttpHeaders).isTrue();
|
||||
assertThat(result).as("Invalid result").isEqualTo(expected);
|
||||
}
|
||||
|
||||
|
||||
+6
-12
@@ -82,8 +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);
|
||||
|
||||
boolean condition = result instanceof Map;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof Map).isTrue();
|
||||
assertThat(result).as("Invalid result").isEqualTo(expected);
|
||||
}
|
||||
|
||||
@@ -101,8 +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);
|
||||
|
||||
boolean condition = result instanceof MultiValueMap;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof MultiValueMap).isTrue();
|
||||
assertThat(result).as("Invalid result").isEqualTo(expected);
|
||||
}
|
||||
|
||||
@@ -119,8 +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);
|
||||
|
||||
boolean condition = result instanceof Map;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof Map).isTrue();
|
||||
Map<String, MultipartFile> resultMap = (Map<String, MultipartFile>) result;
|
||||
assertThat(resultMap).hasSize(2);
|
||||
assertThat(resultMap.get("mfile")).isEqualTo(expected1);
|
||||
@@ -142,8 +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);
|
||||
|
||||
boolean condition = result instanceof MultiValueMap;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof MultiValueMap).isTrue();
|
||||
MultiValueMap<String, MultipartFile> resultMap = (MultiValueMap<String, MultipartFile>) result;
|
||||
assertThat(resultMap).hasSize(2);
|
||||
assertThat(resultMap.get("mfilelist")).containsExactly(expected1, expected2);
|
||||
@@ -164,8 +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);
|
||||
|
||||
boolean condition = result instanceof Map;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof Map).isTrue();
|
||||
Map<String, Part> resultMap = (Map<String, Part>) result;
|
||||
assertThat(resultMap).hasSize(2);
|
||||
assertThat(resultMap.get("mfile")).isEqualTo(expected1);
|
||||
@@ -188,8 +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);
|
||||
|
||||
boolean condition = result instanceof MultiValueMap;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof MultiValueMap).isTrue();
|
||||
MultiValueMap<String, Part> resultMap = (MultiValueMap<String, Part>) result;
|
||||
assertThat(resultMap).hasSize(2);
|
||||
assertThat(resultMap.get("mfilelist")).containsExactly(expected1, expected2);
|
||||
|
||||
+1
-2
@@ -104,8 +104,7 @@ class SessionAttributesHandlerTests {
|
||||
|
||||
assertThat(sessionAttributeStore.retrieveAttribute(request, "attr1")).isEqualTo("value1");
|
||||
assertThat(sessionAttributeStore.retrieveAttribute(request, "attr2")).isEqualTo("value2");
|
||||
boolean condition = sessionAttributeStore.retrieveAttribute(request, "attr3") instanceof TestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(sessionAttributeStore.retrieveAttribute(request, "attr3") instanceof TestBean).isTrue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-2
@@ -66,8 +66,7 @@ class WebHttpHandlerBuilderTests {
|
||||
context.refresh();
|
||||
|
||||
HttpHandler httpHandler = WebHttpHandlerBuilder.applicationContext(context).build();
|
||||
boolean condition = httpHandler instanceof HttpWebHandlerAdapter;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(httpHandler instanceof HttpWebHandlerAdapter).isTrue();
|
||||
assertThat(((HttpWebHandlerAdapter) httpHandler).getApplicationContext()).isSameAs(context);
|
||||
|
||||
MockServerHttpRequest request = MockServerHttpRequest.get("/").build();
|
||||
|
||||
+1
-2
@@ -114,8 +114,7 @@ class DelegatingWebFluxConfigurationTests {
|
||||
verify(webFluxConfigurer).configureArgumentResolvers(any());
|
||||
|
||||
assertThat(initializer).isNotNull();
|
||||
boolean condition = initializer.getValidator() instanceof LocalValidatorFactoryBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(initializer.getValidator() instanceof LocalValidatorFactoryBean).isTrue();
|
||||
assertThat(initializer.getConversionService()).isSameAs(formatterRegistry.getValue());
|
||||
assertThat(codecsConfigurer.getValue().getReaders()).hasSize(16);
|
||||
}
|
||||
|
||||
+2
-4
@@ -79,8 +79,7 @@ class ResourceHandlerFunctionTests {
|
||||
|
||||
Mono<Void> result = responseMono.flatMap(response -> {
|
||||
assertThat(response.statusCode()).isEqualTo(HttpStatus.OK);
|
||||
boolean condition = response instanceof EntityResponse;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(response instanceof EntityResponse).isTrue();
|
||||
@SuppressWarnings("unchecked")
|
||||
EntityResponse<Resource> entityResponse = (EntityResponse<Resource>) response;
|
||||
assertThat(entityResponse.entity()).isEqualTo(this.resource);
|
||||
@@ -116,8 +115,7 @@ class ResourceHandlerFunctionTests {
|
||||
|
||||
Mono<Void> result = responseMono.flatMap(response -> {
|
||||
assertThat(response.statusCode()).isEqualTo(HttpStatus.OK);
|
||||
boolean condition = response instanceof EntityResponse;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(response instanceof EntityResponse).isTrue();
|
||||
@SuppressWarnings("unchecked")
|
||||
EntityResponse<Resource> entityResponse = (EntityResponse<Resource>) response;
|
||||
assertThat(entityResponse.entity().getFilename()).isEqualTo(this.resource.getFilename());
|
||||
|
||||
+4
-8
@@ -85,8 +85,7 @@ class EncodedResourceResolverTests {
|
||||
assertThat(actual.getDescription()).isEqualTo(getResource(file + ".gz").getDescription());
|
||||
assertThat(actual.getFilename()).isEqualTo(getResource(file).getFilename());
|
||||
|
||||
boolean condition = actual instanceof HttpResource;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(actual instanceof HttpResource).isTrue();
|
||||
HttpHeaders headers = ((HttpResource) actual).getResponseHeaders();
|
||||
assertThat(headers.getFirst(HttpHeaders.CONTENT_ENCODING)).isEqualTo("gzip");
|
||||
assertThat(headers.getFirst(HttpHeaders.VARY)).isEqualTo("Accept-Encoding");
|
||||
@@ -103,8 +102,7 @@ class EncodedResourceResolverTests {
|
||||
|
||||
assertThat(actual.getDescription()).isEqualTo(getResource("foo.css.gz").getDescription());
|
||||
assertThat(actual.getFilename()).isEqualTo(getResource("foo.css").getFilename());
|
||||
boolean condition = actual instanceof HttpResource;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(actual instanceof HttpResource).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -121,8 +119,7 @@ class EncodedResourceResolverTests {
|
||||
|
||||
assertThat(resolved.getDescription()).isEqualTo(getResource(file + ".gz").getDescription());
|
||||
assertThat(resolved.getFilename()).isEqualTo(getResource(file).getFilename());
|
||||
boolean condition = resolved instanceof HttpResource;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(resolved instanceof HttpResource).isTrue();
|
||||
|
||||
// 2. Resolve unencoded resource
|
||||
|
||||
@@ -131,8 +128,7 @@ class EncodedResourceResolverTests {
|
||||
|
||||
assertThat(resolved.getDescription()).isEqualTo(getResource(file).getDescription());
|
||||
assertThat(resolved.getFilename()).isEqualTo(getResource(file).getFilename());
|
||||
boolean condition1 = resolved instanceof HttpResource;
|
||||
assertThat(condition1).isFalse();
|
||||
assertThat(resolved instanceof HttpResource).isFalse();
|
||||
}
|
||||
|
||||
@Test // SPR-13149
|
||||
|
||||
+1
-4
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.web.reactive.result.condition;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
@@ -147,8 +145,7 @@ class HeadersRequestConditionTests {
|
||||
HeadersRequestCondition condition2 = new HeadersRequestCondition("foo=baz");
|
||||
|
||||
HeadersRequestCondition result = condition1.combine(condition2);
|
||||
Collection<?> conditions = result.getContent();
|
||||
assertThat(conditions).hasSize(2);
|
||||
assertThat(result.getContent()).hasSize(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-4
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.web.reactive.result.condition;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
@@ -138,8 +136,7 @@ class ParamsRequestConditionTests {
|
||||
ParamsRequestCondition condition2 = new ParamsRequestCondition("foo=baz");
|
||||
|
||||
ParamsRequestCondition result = condition1.combine(condition2);
|
||||
Collection<?> conditions = result.getContent();
|
||||
assertThat(conditions).hasSize(2);
|
||||
assertThat(result.getContent()).hasSize(2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-2
@@ -113,8 +113,7 @@ class CookieValueMethodArgumentResolverTests {
|
||||
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/"));
|
||||
Object result = this.resolver.resolveArgument(this.cookieStringParameter, this.bindingContext, exchange).block();
|
||||
|
||||
boolean condition = result instanceof String;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof String).isTrue();
|
||||
assertThat(result).isEqualTo("bar");
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -149,8 +149,7 @@ class PathVariableMethodArgumentResolverTests {
|
||||
|
||||
StepVerifier.create(mono)
|
||||
.consumeNextWith(value -> {
|
||||
boolean condition = value instanceof Optional;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(value instanceof Optional).isTrue();
|
||||
assertThat(((Optional<?>) value)).isNotPresent();
|
||||
})
|
||||
.expectComplete()
|
||||
|
||||
+1
-2
@@ -154,8 +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);
|
||||
boolean condition = value instanceof Mono;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(value instanceof Mono).isTrue();
|
||||
assertThat(((Mono<?>) value).block(Duration.ZERO)).isSameAs(foo);
|
||||
|
||||
// No attribute --> Mono.empty
|
||||
|
||||
+2
-4
@@ -90,8 +90,7 @@ class RequestHeaderMapMethodArgumentResolverTests {
|
||||
Mono<Object> mono = resolver.resolveArgument(paramMap, null, exchange);
|
||||
Object result = mono.block();
|
||||
|
||||
boolean condition = result instanceof Map;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof Map).isTrue();
|
||||
assertThat(result).as("Invalid result").isEqualTo(expected);
|
||||
}
|
||||
|
||||
@@ -130,8 +129,7 @@ class RequestHeaderMapMethodArgumentResolverTests {
|
||||
Mono<Object> mono = resolver.resolveArgument(paramHttpHeaders, null, exchange);
|
||||
Object result = mono.block();
|
||||
|
||||
boolean condition = result instanceof HttpHeaders;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof HttpHeaders).isTrue();
|
||||
assertThat(result).as("Invalid result").isEqualTo(expected);
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -73,8 +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")));
|
||||
boolean condition = result instanceof Map;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof Map).isTrue();
|
||||
assertThat(result).isEqualTo(Collections.singletonMap("foo", "bar"));
|
||||
}
|
||||
|
||||
@@ -84,8 +83,7 @@ class RequestParamMapMethodArgumentResolverTests {
|
||||
ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/path?foo=bar&foo=baz"));
|
||||
Object result= resolve(param, exchange);
|
||||
|
||||
boolean condition = result instanceof MultiValueMap;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(result instanceof MultiValueMap).isTrue();
|
||||
assertThat(result).isEqualTo(Collections.singletonMap("foo", Arrays.asList("bar", "baz")));
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -98,8 +98,7 @@ class SessionAttributesHandlerTests {
|
||||
|
||||
assertThat(session.getAttributes().get("attr1")).isEqualTo("value1");
|
||||
assertThat(session.getAttributes().get("attr2")).isEqualTo("value2");
|
||||
boolean condition = session.getAttributes().get("attr3") instanceof TestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(session.getAttributes().get("attr3") instanceof TestBean).isTrue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,16 +70,14 @@ class ContextLoaderTests {
|
||||
listener.contextInitialized(event);
|
||||
String contextAttr = WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE;
|
||||
WebApplicationContext context = (WebApplicationContext) sc.getAttribute(contextAttr);
|
||||
boolean condition1 = context instanceof XmlWebApplicationContext;
|
||||
assertThat(condition1).as("Correct WebApplicationContext exposed in ServletContext").isTrue();
|
||||
assertThat(context instanceof XmlWebApplicationContext).as("Correct WebApplicationContext exposed in ServletContext").isTrue();
|
||||
assertThat(WebApplicationContextUtils.getRequiredWebApplicationContext(sc)).isInstanceOf(
|
||||
XmlWebApplicationContext.class);
|
||||
LifecycleBean lb = (LifecycleBean) context.getBean("lifecycle");
|
||||
assertThat(context.containsBean("father")).as("Has father").isTrue();
|
||||
assertThat(context.containsBean("rod")).as("Has rod").isTrue();
|
||||
assertThat(context.containsBean("kerry")).as("Has kerry").isTrue();
|
||||
boolean condition = !lb.isDestroyed();
|
||||
assertThat(condition).as("Not destroyed").isTrue();
|
||||
assertThat(!lb.isDestroyed()).as("Not destroyed").isTrue();
|
||||
assertThat(context.containsBean("beans1.bean1")).isFalse();
|
||||
assertThat(context.containsBean("beans1.bean2")).isFalse();
|
||||
listener.contextDestroyed(event);
|
||||
@@ -241,8 +239,7 @@ class ContextLoaderTests {
|
||||
listener.contextInitialized(event);
|
||||
String contextAttr = WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE;
|
||||
WebApplicationContext wc = (WebApplicationContext) sc.getAttribute(contextAttr);
|
||||
boolean condition = wc instanceof SimpleWebApplicationContext;
|
||||
assertThat(condition).as("Correct WebApplicationContext exposed in ServletContext").isTrue();
|
||||
assertThat(wc instanceof SimpleWebApplicationContext).as("Correct WebApplicationContext exposed in ServletContext").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+4
-8
@@ -112,8 +112,7 @@ class DelegatingWebMvcConfigurationTests {
|
||||
|
||||
assertThat(initializer).isNotNull();
|
||||
assertThat(initializer.getConversionService()).isSameAs(conversionService.getValue());
|
||||
boolean condition = initializer.getValidator() instanceof LocalValidatorFactoryBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(initializer.getValidator() instanceof LocalValidatorFactoryBean).isTrue();
|
||||
assertThat(resolvers.getValue()).isEmpty();
|
||||
assertThat(handlers.getValue()).isEmpty();
|
||||
assertThat(adapter.getMessageConverters()).isEqualTo(converters.getValue());
|
||||
@@ -171,12 +170,9 @@ class DelegatingWebMvcConfigurationTests {
|
||||
verify(webMvcConfigurer).configureHandlerExceptionResolvers(exceptionResolvers.capture());
|
||||
|
||||
assertThat(exceptionResolvers.getValue()).hasSize(3);
|
||||
boolean condition2 = exceptionResolvers.getValue().get(0) instanceof ExceptionHandlerExceptionResolver;
|
||||
assertThat(condition2).isTrue();
|
||||
boolean condition1 = exceptionResolvers.getValue().get(1) instanceof ResponseStatusExceptionResolver;
|
||||
assertThat(condition1).isTrue();
|
||||
boolean condition = exceptionResolvers.getValue().get(2) instanceof DefaultHandlerExceptionResolver;
|
||||
assertThat(condition).isTrue();
|
||||
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(converters.getValue()).isNotEmpty();
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -202,8 +202,7 @@ class InterceptorRegistryTests {
|
||||
private void verifyWebInterceptor(HandlerInterceptor interceptor,
|
||||
TestWebRequestInterceptor webInterceptor) throws Exception {
|
||||
|
||||
boolean condition = interceptor instanceof WebRequestHandlerInterceptorAdapter;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(interceptor instanceof WebRequestHandlerInterceptorAdapter).isTrue();
|
||||
interceptor.preHandle(this.request, this.response, null);
|
||||
assertThat(webInterceptor.preHandleInvoked).isTrue();
|
||||
}
|
||||
|
||||
+2
-4
@@ -198,13 +198,11 @@ class WebMvcConfigurationSupportTests {
|
||||
|
||||
ConversionService conversionService = initializer.getConversionService();
|
||||
assertThat(conversionService).isNotNull();
|
||||
boolean condition1 = conversionService instanceof FormattingConversionService;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(conversionService instanceof FormattingConversionService).isTrue();
|
||||
|
||||
Validator validator = initializer.getValidator();
|
||||
assertThat(validator).isNotNull();
|
||||
boolean condition = validator instanceof LocalValidatorFactoryBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(validator instanceof LocalValidatorFactoryBean).isTrue();
|
||||
|
||||
DirectFieldAccessor fieldAccessor = new DirectFieldAccessor(adapter);
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
+3
-6
@@ -93,8 +93,7 @@ class LocaleResolverTests {
|
||||
else {
|
||||
assertThat(localeContext.getLocale()).isEqualTo(Locale.UK);
|
||||
}
|
||||
boolean condition2 = localeContext instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition2).isTrue();
|
||||
assertThat(localeContext instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
assertThat(((TimeZoneAwareLocaleContext) localeContext).getTimeZone()).isNull();
|
||||
|
||||
if (localeContextResolver instanceof AbstractLocaleContextResolver) {
|
||||
@@ -122,16 +121,14 @@ class LocaleResolverTests {
|
||||
new SimpleTimeZoneAwareLocaleContext(Locale.GERMANY, TimeZone.getTimeZone("GMT+2")));
|
||||
localeContext = localeContextResolver.resolveLocaleContext(request);
|
||||
assertThat(localeContext.getLocale()).isEqualTo(Locale.GERMANY);
|
||||
boolean condition1 = localeContext instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(localeContext instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
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);
|
||||
boolean condition = localeContext instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(localeContext instanceof TimeZoneAwareLocaleContext).isTrue();
|
||||
assertThat(TimeZone.getTimeZone("GMT+3")).isEqualTo(((TimeZoneAwareLocaleContext) localeContext).getTimeZone());
|
||||
|
||||
if (localeContextResolver instanceof AbstractLocaleContextResolver) {
|
||||
|
||||
+1
-5
@@ -16,11 +16,8 @@
|
||||
|
||||
package org.springframework.web.servlet.mvc.condition;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.web.servlet.mvc.condition.HeadersRequestCondition.HeaderExpression;
|
||||
import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -160,8 +157,7 @@ class HeadersRequestConditionTests {
|
||||
HeadersRequestCondition condition2 = new HeadersRequestCondition("foo=baz");
|
||||
|
||||
HeadersRequestCondition result = condition1.combine(condition2);
|
||||
Collection<HeaderExpression> conditions = result.getContent();
|
||||
assertThat(conditions).hasSize(2);
|
||||
assertThat(result.getContent()).hasSize(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-5
@@ -16,11 +16,8 @@
|
||||
|
||||
package org.springframework.web.servlet.mvc.condition;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.web.servlet.mvc.condition.ParamsRequestCondition.ParamExpression;
|
||||
import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -149,8 +146,7 @@ class ParamsRequestConditionTests {
|
||||
ParamsRequestCondition condition2 = new ParamsRequestCondition("foo=baz");
|
||||
|
||||
ParamsRequestCondition result = condition1.combine(condition2);
|
||||
Collection<ParamExpression> conditions = result.getContent();
|
||||
assertThat(conditions).hasSize(2);
|
||||
assertThat(result.getContent()).hasSize(2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-6
@@ -396,8 +396,7 @@ class RequestPartMethodArgumentResolverTests {
|
||||
webRequest = new ServletWebRequest(request);
|
||||
|
||||
Object actualValue = resolver.resolveArgument(optionalMultipartFileList, null, webRequest, null);
|
||||
boolean condition1 = actualValue instanceof Optional;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(actualValue instanceof Optional).isTrue();
|
||||
assertThat(((Optional<?>) actualValue).get()).as("Invalid result").isEqualTo(Collections.singletonList(expected));
|
||||
|
||||
actualValue = resolver.resolveArgument(optionalMultipartFileList, null, webRequest, null);
|
||||
@@ -439,8 +438,7 @@ class RequestPartMethodArgumentResolverTests {
|
||||
webRequest = new ServletWebRequest(request);
|
||||
|
||||
Object actualValue = resolver.resolveArgument(optionalPart, null, webRequest, null);
|
||||
boolean condition1 = actualValue instanceof Optional;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(actualValue instanceof Optional).isTrue();
|
||||
assertThat(((Optional<?>) actualValue).get()).as("Invalid result").isEqualTo(expected);
|
||||
|
||||
actualValue = resolver.resolveArgument(optionalPart, null, webRequest, null);
|
||||
@@ -484,8 +482,7 @@ class RequestPartMethodArgumentResolverTests {
|
||||
webRequest = new ServletWebRequest(request);
|
||||
|
||||
Object actualValue = resolver.resolveArgument(optionalPartList, null, webRequest, null);
|
||||
boolean condition1 = actualValue instanceof Optional;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(actualValue instanceof Optional).isTrue();
|
||||
assertThat(((Optional<?>) actualValue).get()).as("Invalid result").isEqualTo(Collections.singletonList(expected));
|
||||
|
||||
actualValue = resolver.resolveArgument(optionalPartList, null, webRequest, null);
|
||||
|
||||
+2
-4
@@ -398,10 +398,8 @@ class ResponseEntityExceptionHandlerTests {
|
||||
servlet.service(this.servletRequest, this.servletResponse);
|
||||
}
|
||||
catch (ServletException ex) {
|
||||
boolean condition1 = ex.getCause() instanceof IllegalStateException;
|
||||
assertThat(condition1).isTrue();
|
||||
boolean condition = ex.getCause().getCause() instanceof ServletRequestBindingException;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(ex.getCause() instanceof IllegalStateException).isTrue();
|
||||
assertThat(ex.getCause().getCause() instanceof ServletRequestBindingException).isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -2644,8 +2644,7 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
|
||||
public String myOtherHandle(TB tb, BindingResult errors, ExtendedModelMap model, MySpecialArg arg) {
|
||||
TestBean tbReal = (TestBean) tb;
|
||||
tbReal.setName("myName");
|
||||
boolean condition = model.get("ITestBean") instanceof DerivedTestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(model.get("ITestBean") instanceof DerivedTestBean).isTrue();
|
||||
assertThat(arg).isNotNull();
|
||||
return super.myHandle(tbReal, errors, model);
|
||||
}
|
||||
|
||||
+4
-8
@@ -78,8 +78,7 @@ class EncodedResourceResolverTests {
|
||||
assertThat(actual.getDescription()).isEqualTo(getResource(file + ".gz").getDescription());
|
||||
assertThat(actual.getFilename()).isEqualTo(getResource(file).getFilename());
|
||||
|
||||
boolean condition = actual instanceof HttpResource;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(actual instanceof HttpResource).isTrue();
|
||||
HttpHeaders headers = ((HttpResource) actual).getResponseHeaders();
|
||||
assertThat(headers.getFirst(HttpHeaders.CONTENT_ENCODING)).isEqualTo("gzip");
|
||||
assertThat(headers.getFirst(HttpHeaders.VARY)).isEqualTo("Accept-Encoding");
|
||||
@@ -95,8 +94,7 @@ class EncodedResourceResolverTests {
|
||||
|
||||
assertThat(resolved.getDescription()).isEqualTo(getResource("foo.css.gz").getDescription());
|
||||
assertThat(resolved.getFilename()).isEqualTo(getResource("foo.css").getFilename());
|
||||
boolean condition = resolved instanceof HttpResource;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(resolved instanceof HttpResource).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -110,8 +108,7 @@ class EncodedResourceResolverTests {
|
||||
|
||||
assertThat(resolved.getDescription()).isEqualTo(getResource(file + ".gz").getDescription());
|
||||
assertThat(resolved.getFilename()).isEqualTo(getResource(file).getFilename());
|
||||
boolean condition = resolved instanceof HttpResource;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(resolved instanceof HttpResource).isTrue();
|
||||
|
||||
// 2. Resolve unencoded resource
|
||||
request = new MockHttpServletRequest("GET", "/js/foo.js");
|
||||
@@ -119,8 +116,7 @@ class EncodedResourceResolverTests {
|
||||
|
||||
assertThat(resolved.getDescription()).isEqualTo(getResource(file).getDescription());
|
||||
assertThat(resolved.getFilename()).isEqualTo(getResource(file).getFilename());
|
||||
boolean condition1 = resolved instanceof HttpResource;
|
||||
assertThat(condition1).isFalse();
|
||||
assertThat(resolved instanceof HttpResource).isFalse();
|
||||
}
|
||||
|
||||
@Test // SPR-13149
|
||||
|
||||
+2
-4
@@ -92,8 +92,7 @@ class AnnotationConfigDispatcherServletInitializerTests {
|
||||
((AnnotationConfigWebApplicationContext) wac).refresh();
|
||||
|
||||
assertThat(wac.containsBean("bean")).isTrue();
|
||||
boolean condition = wac.getBean("bean") instanceof MyBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(wac.getBean("bean") instanceof MyBean).isTrue();
|
||||
|
||||
assertThat(servletRegistrations).hasSize(1);
|
||||
assertThat(servletRegistrations.get(SERVLET_NAME)).isNotNull();
|
||||
@@ -161,8 +160,7 @@ class AnnotationConfigDispatcherServletInitializerTests {
|
||||
((AnnotationConfigWebApplicationContext) wac).refresh();
|
||||
|
||||
assertThat(wac.containsBean("bean")).isTrue();
|
||||
boolean condition = wac.getBean("bean") instanceof MyBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(wac.getBean("bean") instanceof MyBean).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-2
@@ -67,8 +67,7 @@ class DispatcherServletInitializerTests {
|
||||
WebApplicationContext servletContext = servlet.getWebApplicationContext();
|
||||
|
||||
assertThat(servletContext.containsBean("bean")).isTrue();
|
||||
boolean condition = servletContext.getBean("bean") instanceof MyBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(servletContext.getBean("bean") instanceof MyBean).isTrue();
|
||||
|
||||
assertThat(registrations).hasSize(1);
|
||||
assertThat(registrations.get(SERVLET_NAME)).isNotNull();
|
||||
|
||||
@@ -65,8 +65,7 @@ class BindTagTests extends AbstractTagTests {
|
||||
assertThat(status.getExpression()).as("Correct expression").isNull();
|
||||
assertThat(status.getValue()).as("Correct value").isNull();
|
||||
assertThat(status.getDisplayValue()).as("Correct displayValue").isEmpty();
|
||||
boolean condition = !status.isError();
|
||||
assertThat(condition).as("Correct isError").isTrue();
|
||||
assertThat(!status.isError()).as("Correct isError").isTrue();
|
||||
assertThat(status.getErrorCodes()).as("Correct errorCodes").isEmpty();
|
||||
assertThat(status.getErrorMessages()).as("Correct errorMessages").isEmpty();
|
||||
assertThat(status.getErrorCode()).as("Correct errorCode").isEmpty();
|
||||
@@ -480,8 +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]");
|
||||
boolean condition = status.getValue() instanceof TestBean;
|
||||
assertThat(condition).as("Value is TestBean").isTrue();
|
||||
assertThat(status.getValue() instanceof TestBean).as("Value is TestBean").isTrue();
|
||||
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);
|
||||
@@ -508,8 +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]");
|
||||
boolean condition = status.getValue() instanceof TestBean;
|
||||
assertThat(condition).as("Value is TestBean").isTrue();
|
||||
assertThat(status.getValue() instanceof TestBean).as("Value is TestBean").isTrue();
|
||||
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);
|
||||
@@ -544,8 +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
|
||||
boolean condition = status.getValue() instanceof String;
|
||||
assertThat(condition).as("Value is TestBean").isTrue();
|
||||
assertThat(status.getValue() instanceof String).as("Value is TestBean").isTrue();
|
||||
assertThat(status.getValue()).as("Correct value").isEqualTo("something");
|
||||
}
|
||||
|
||||
@@ -563,8 +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");
|
||||
boolean condition = status.getValue() instanceof NestedTestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(status.getValue() instanceof NestedTestBean).isTrue();
|
||||
assertThat(status.getDisplayValue()).contains("juergen&eva");
|
||||
}
|
||||
|
||||
@@ -579,8 +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");
|
||||
boolean condition = status.getValue() instanceof Set;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(status.getValue() instanceof Set).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+12
-24
@@ -49,20 +49,16 @@ class HtmlEscapeTagTests extends AbstractTagTests {
|
||||
testTag.setPageContext(pc);
|
||||
testTag.doStartTag();
|
||||
|
||||
boolean condition7 = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition7).as("Correct default").isTrue();
|
||||
boolean condition6 = !testTag.isHtmlEscape();
|
||||
assertThat(condition6).as("Correctly applied").isTrue();
|
||||
assertThat(!tag.getRequestContext().isDefaultHtmlEscape()).as("Correct default").isTrue();
|
||||
assertThat(!testTag.isHtmlEscape()).as("Correctly applied").isTrue();
|
||||
tag.setDefaultHtmlEscape(true);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly enabled").isTrue();
|
||||
assertThat(testTag.isHtmlEscape()).as("Correctly applied").isTrue();
|
||||
tag.setDefaultHtmlEscape(false);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
boolean condition5 = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition5).as("Correctly disabled").isTrue();
|
||||
boolean condition4 = !testTag.isHtmlEscape();
|
||||
assertThat(condition4).as("Correctly applied").isTrue();
|
||||
assertThat(!tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly disabled").isTrue();
|
||||
assertThat(!testTag.isHtmlEscape()).as("Correctly applied").isTrue();
|
||||
|
||||
tag.setDefaultHtmlEscape(true);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
@@ -71,19 +67,15 @@ class HtmlEscapeTagTests extends AbstractTagTests {
|
||||
assertThat(testTag.isHtmlEscape()).as("Correctly applied").isTrue();
|
||||
testTag.setHtmlEscape(false);
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly enabled").isTrue();
|
||||
boolean condition3 = !testTag.isHtmlEscape();
|
||||
assertThat(condition3).as("Correctly applied").isTrue();
|
||||
assertThat(!testTag.isHtmlEscape()).as("Correctly applied").isTrue();
|
||||
tag.setDefaultHtmlEscape(false);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
testTag.setHtmlEscape(true);
|
||||
boolean condition2 = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition2).as("Correctly disabled").isTrue();
|
||||
assertThat(!tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly disabled").isTrue();
|
||||
assertThat(testTag.isHtmlEscape()).as("Correctly applied").isTrue();
|
||||
testTag.setHtmlEscape(false);
|
||||
boolean condition1 = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition1).as("Correctly disabled").isTrue();
|
||||
boolean condition = !testTag.isHtmlEscape();
|
||||
assertThat(condition).as("Correctly applied").isTrue();
|
||||
assertThat(!tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly disabled").isTrue();
|
||||
assertThat(!testTag.isHtmlEscape()).as("Correctly applied").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -96,15 +88,13 @@ class HtmlEscapeTagTests extends AbstractTagTests {
|
||||
tag.setPageContext(pc);
|
||||
tag.doStartTag();
|
||||
|
||||
boolean condition1 = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition1).as("Correct default").isTrue();
|
||||
assertThat(!tag.getRequestContext().isDefaultHtmlEscape()).as("Correct default").isTrue();
|
||||
tag.setDefaultHtmlEscape(true);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly enabled").isTrue();
|
||||
tag.setDefaultHtmlEscape(false);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
boolean condition = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition).as("Correctly disabled").isTrue();
|
||||
assertThat(!tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly disabled").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -116,15 +106,13 @@ class HtmlEscapeTagTests extends AbstractTagTests {
|
||||
tag.doStartTag();
|
||||
|
||||
sc.addInitParameter(WebUtils.HTML_ESCAPE_CONTEXT_PARAM, "false");
|
||||
boolean condition1 = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition1).as("Correct default").isTrue();
|
||||
assertThat(!tag.getRequestContext().isDefaultHtmlEscape()).as("Correct default").isTrue();
|
||||
tag.setDefaultHtmlEscape(true);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly enabled").isTrue();
|
||||
tag.setDefaultHtmlEscape(false);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
boolean condition = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition).as("Correctly disabled").isTrue();
|
||||
assertThat(!tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly disabled").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+2
-4
@@ -346,8 +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();
|
||||
boolean condition = getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE) instanceof List;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE) instanceof List).isTrue();
|
||||
String bodyContent = "Foo";
|
||||
this.tag.setBodyContent(new MockBodyContent(bodyContent, getWriter()));
|
||||
this.tag.doEndTag();
|
||||
@@ -367,8 +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();
|
||||
boolean condition = getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE) instanceof List;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE) instanceof List).isTrue();
|
||||
String bodyContent = "Foo";
|
||||
this.tag.setBodyContent(new MockBodyContent(bodyContent, getWriter()));
|
||||
this.tag.doEndTag();
|
||||
|
||||
+1
-2
@@ -176,8 +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();
|
||||
boolean condition = this.request.getAttribute("rc") instanceof RequestContext;
|
||||
assertThat(condition).as("Correct rc attribute").isTrue();
|
||||
assertThat(this.request.getAttribute("rc") instanceof RequestContext).as("Correct rc attribute").isTrue();
|
||||
|
||||
view = vr.resolveViewName("redirect:myUrl", Locale.getDefault());
|
||||
assertThat(view.getClass()).as("Correct view class").isEqualTo(RedirectView.class);
|
||||
|
||||
+8
-16
@@ -83,8 +83,7 @@ class HandlersBeanDefinitionParserTests {
|
||||
assertThat(handlersMap).hasSize(2);
|
||||
|
||||
for (HandlerMapping hm : handlersMap.values()) {
|
||||
boolean condition2 = hm instanceof SimpleUrlHandlerMapping;
|
||||
assertThat(condition2).isTrue();
|
||||
assertThat(hm instanceof SimpleUrlHandlerMapping).isTrue();
|
||||
SimpleUrlHandlerMapping shm = (SimpleUrlHandlerMapping) hm;
|
||||
|
||||
if (shm.getUrlMap().containsKey("/foo")) {
|
||||
@@ -94,11 +93,9 @@ class HandlersBeanDefinitionParserTests {
|
||||
unwrapAndCheckDecoratedHandlerType(handler.getWebSocketHandler(), FooWebSocketHandler.class);
|
||||
HandshakeHandler handshakeHandler = handler.getHandshakeHandler();
|
||||
assertThat(handshakeHandler).isNotNull();
|
||||
boolean condition1 = handshakeHandler instanceof DefaultHandshakeHandler;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(handshakeHandler instanceof DefaultHandshakeHandler).isTrue();
|
||||
assertThat(handler.getHandshakeInterceptors()).isNotEmpty();
|
||||
boolean condition = handler.getHandshakeInterceptors().get(0) instanceof OriginHandshakeInterceptor;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(handler.getHandshakeInterceptors().get(0) instanceof OriginHandshakeInterceptor).isTrue();
|
||||
}
|
||||
else {
|
||||
assertThat(shm.getUrlMap()).containsOnlyKeys("/test");
|
||||
@@ -107,11 +104,9 @@ class HandlersBeanDefinitionParserTests {
|
||||
unwrapAndCheckDecoratedHandlerType(handler.getWebSocketHandler(), TestWebSocketHandler.class);
|
||||
HandshakeHandler handshakeHandler = handler.getHandshakeHandler();
|
||||
assertThat(handshakeHandler).isNotNull();
|
||||
boolean condition1 = handshakeHandler instanceof DefaultHandshakeHandler;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(handshakeHandler instanceof DefaultHandshakeHandler).isTrue();
|
||||
assertThat(handler.getHandshakeInterceptors()).isNotEmpty();
|
||||
boolean condition = handler.getHandshakeInterceptors().get(0) instanceof OriginHandshakeInterceptor;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(handler.getHandshakeInterceptors().get(0) instanceof OriginHandshakeInterceptor).isTrue();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,8 +117,7 @@ class HandlersBeanDefinitionParserTests {
|
||||
|
||||
HandlerMapping handlerMapping = this.appContext.getBean(HandlerMapping.class);
|
||||
assertThat(handlerMapping).isNotNull();
|
||||
boolean condition2 = handlerMapping instanceof SimpleUrlHandlerMapping;
|
||||
assertThat(condition2).isTrue();
|
||||
assertThat(handlerMapping instanceof SimpleUrlHandlerMapping).isTrue();
|
||||
|
||||
SimpleUrlHandlerMapping urlHandlerMapping = (SimpleUrlHandlerMapping) handlerMapping;
|
||||
assertThat(urlHandlerMapping.getOrder()).isEqualTo(2);
|
||||
@@ -133,8 +127,7 @@ class HandlersBeanDefinitionParserTests {
|
||||
unwrapAndCheckDecoratedHandlerType(handler.getWebSocketHandler(), FooWebSocketHandler.class);
|
||||
HandshakeHandler handshakeHandler = handler.getHandshakeHandler();
|
||||
assertThat(handshakeHandler).isNotNull();
|
||||
boolean condition1 = handshakeHandler instanceof TestHandshakeHandler;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(handshakeHandler instanceof TestHandshakeHandler).isTrue();
|
||||
List<HandshakeInterceptor> interceptors = handler.getHandshakeInterceptors();
|
||||
assertThat(interceptors).extracting("class")
|
||||
.containsExactlyInAnyOrder(FooTestInterceptor.class, BarTestInterceptor.class, OriginHandshakeInterceptor.class);
|
||||
@@ -144,8 +137,7 @@ class HandlersBeanDefinitionParserTests {
|
||||
unwrapAndCheckDecoratedHandlerType(handler.getWebSocketHandler(), TestWebSocketHandler.class);
|
||||
handshakeHandler = handler.getHandshakeHandler();
|
||||
assertThat(handshakeHandler).isNotNull();
|
||||
boolean condition = handshakeHandler instanceof TestHandshakeHandler;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(handshakeHandler instanceof TestHandshakeHandler).isTrue();
|
||||
interceptors = handler.getHandshakeInterceptors();
|
||||
assertThat(interceptors).extracting("class")
|
||||
.containsExactlyInAnyOrder(FooTestInterceptor.class, BarTestInterceptor.class, OriginHandshakeInterceptor.class);
|
||||
|
||||
Reference in New Issue
Block a user