Polishing and removal of "this." for method invocations
Backport Bot / build (push) Waiting to run
Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run
Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run
Details
Backport Bot / build (push) Waiting to run
Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run
Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run
Details
This commit is contained in:
parent
99890b6147
commit
18d6a55e3e
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -24,7 +24,7 @@ import java.util.Map;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract superclass for counting advices etc.
|
* Abstract superclass for counting advice, etc.
|
||||||
*
|
*
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
|
@ -62,7 +62,7 @@ public class MethodCounter implements Serializable {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object other) {
|
public boolean equals(@Nullable Object other) {
|
||||||
return (other != null && other.getClass() == this.getClass());
|
return (other != null && getClass() == other.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -33,13 +33,14 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
*/
|
*/
|
||||||
class FactoryBeanLookupTests {
|
class FactoryBeanLookupTests {
|
||||||
private BeanFactory beanFactory;
|
|
||||||
|
private final BeanFactory beanFactory = new DefaultListableBeanFactory();
|
||||||
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp() {
|
void setUp() {
|
||||||
beanFactory = new DefaultListableBeanFactory();
|
|
||||||
new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory).loadBeanDefinitions(
|
new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory).loadBeanDefinitions(
|
||||||
new ClassPathResource("FactoryBeanLookupTests-context.xml", this.getClass()));
|
new ClassPathResource("FactoryBeanLookupTests-context.xml", getClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -71,6 +72,7 @@ class FactoryBeanLookupTests {
|
||||||
Foo foo = beanFactory.getBean("fooFactory", Foo.class);
|
Foo foo = beanFactory.getBean("fooFactory", Foo.class);
|
||||||
assertThat(foo).isNotNull();
|
assertThat(foo).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FooFactoryBean extends AbstractFactoryBean<Foo> {
|
class FooFactoryBean extends AbstractFactoryBean<Foo> {
|
||||||
|
|
|
@ -2453,7 +2453,7 @@ class AutowiredAnnotationBeanPostProcessorTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
void genericsBasedConstructorInjectionWithNonTypedTarget() {
|
void genericsBasedConstructorInjectionWithNonTypedTarget() {
|
||||||
RootBeanDefinition bd = new RootBeanDefinition(RepositoryConstructorInjectionBean.class);
|
RootBeanDefinition bd = new RootBeanDefinition(RepositoryConstructorInjectionBean.class);
|
||||||
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
|
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -84,7 +84,7 @@ class PropertyPlaceholderConfigurerTests {
|
||||||
.getBeanDefinition());
|
.getBeanDefinition());
|
||||||
|
|
||||||
PropertyPlaceholderConfigurer pc = new PropertyPlaceholderConfigurer();
|
PropertyPlaceholderConfigurer pc = new PropertyPlaceholderConfigurer();
|
||||||
Resource resource = new ClassPathResource("PropertyPlaceholderConfigurerTests.properties", this.getClass());
|
Resource resource = new ClassPathResource("PropertyPlaceholderConfigurerTests.properties", getClass());
|
||||||
pc.setLocation(resource);
|
pc.setLocation(resource);
|
||||||
pc.postProcessBeanFactory(bf);
|
pc.postProcessBeanFactory(bf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -46,7 +46,7 @@ class DuplicateBeanIdTests {
|
||||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||||
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(bf);
|
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(bf);
|
||||||
assertThatException().as("duplicate ids in same nesting level").isThrownBy(() ->
|
assertThatException().as("duplicate ids in same nesting level").isThrownBy(() ->
|
||||||
reader.loadBeanDefinitions(new ClassPathResource("DuplicateBeanIdTests-sameLevel-context.xml", this.getClass())));
|
reader.loadBeanDefinitions(new ClassPathResource("DuplicateBeanIdTests-sameLevel-context.xml", getClass())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -54,7 +54,7 @@ class DuplicateBeanIdTests {
|
||||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||||
bf.setAllowBeanDefinitionOverriding(true);
|
bf.setAllowBeanDefinitionOverriding(true);
|
||||||
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(bf);
|
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(bf);
|
||||||
reader.loadBeanDefinitions(new ClassPathResource("DuplicateBeanIdTests-multiLevel-context.xml", this.getClass()));
|
reader.loadBeanDefinitions(new ClassPathResource("DuplicateBeanIdTests-multiLevel-context.xml", getClass()));
|
||||||
TestBean testBean = bf.getBean(TestBean.class); // there should be only one
|
TestBean testBean = bf.getBean(TestBean.class); // there should be only one
|
||||||
assertThat(testBean.getName()).isEqualTo("nested");
|
assertThat(testBean.getName()).isEqualTo("nested");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -36,7 +36,7 @@ class NestedBeansElementAttributeRecursionTests {
|
||||||
void defaultLazyInit() {
|
void defaultLazyInit() {
|
||||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||||
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
|
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
|
||||||
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", this.getClass()));
|
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", getClass()));
|
||||||
|
|
||||||
assertLazyInits(bf);
|
assertLazyInits(bf);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ class NestedBeansElementAttributeRecursionTests {
|
||||||
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
|
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
|
||||||
xmlBeanDefinitionReader.setValidating(false);
|
xmlBeanDefinitionReader.setValidating(false);
|
||||||
xmlBeanDefinitionReader.loadBeanDefinitions(
|
xmlBeanDefinitionReader.loadBeanDefinitions(
|
||||||
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", this.getClass()));
|
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", getClass()));
|
||||||
|
|
||||||
assertLazyInits(bf);
|
assertLazyInits(bf);
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ class NestedBeansElementAttributeRecursionTests {
|
||||||
void defaultMerge() {
|
void defaultMerge() {
|
||||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||||
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
|
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
|
||||||
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", this.getClass()));
|
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", getClass()));
|
||||||
|
|
||||||
assertMerge(bf);
|
assertMerge(bf);
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ class NestedBeansElementAttributeRecursionTests {
|
||||||
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
|
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
|
||||||
xmlBeanDefinitionReader.setValidating(false);
|
xmlBeanDefinitionReader.setValidating(false);
|
||||||
xmlBeanDefinitionReader.loadBeanDefinitions(
|
xmlBeanDefinitionReader.loadBeanDefinitions(
|
||||||
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", this.getClass()));
|
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", getClass()));
|
||||||
|
|
||||||
assertMerge(bf);
|
assertMerge(bf);
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ class NestedBeansElementAttributeRecursionTests {
|
||||||
void defaultAutowireCandidates() {
|
void defaultAutowireCandidates() {
|
||||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||||
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
|
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
|
||||||
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", this.getClass()));
|
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", getClass()));
|
||||||
|
|
||||||
assertAutowireCandidates(bf);
|
assertAutowireCandidates(bf);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ class NestedBeansElementAttributeRecursionTests {
|
||||||
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
|
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
|
||||||
xmlBeanDefinitionReader.setValidating(false);
|
xmlBeanDefinitionReader.setValidating(false);
|
||||||
xmlBeanDefinitionReader.loadBeanDefinitions(
|
xmlBeanDefinitionReader.loadBeanDefinitions(
|
||||||
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", this.getClass()));
|
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", getClass()));
|
||||||
|
|
||||||
assertAutowireCandidates(bf);
|
assertAutowireCandidates(bf);
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ class NestedBeansElementAttributeRecursionTests {
|
||||||
void initMethod() {
|
void initMethod() {
|
||||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||||
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
|
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
|
||||||
new ClassPathResource("NestedBeansElementAttributeRecursionTests-init-destroy-context.xml", this.getClass()));
|
new ClassPathResource("NestedBeansElementAttributeRecursionTests-init-destroy-context.xml", getClass()));
|
||||||
|
|
||||||
InitDestroyBean beanA = bf.getBean("beanA", InitDestroyBean.class);
|
InitDestroyBean beanA = bf.getBean("beanA", InitDestroyBean.class);
|
||||||
InitDestroyBean beanB = bf.getBean("beanB", InitDestroyBean.class);
|
InitDestroyBean beanB = bf.getBean("beanB", InitDestroyBean.class);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -26,15 +26,14 @@ import org.springframework.core.io.Resource;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for new nested beans element support in Spring XML
|
* Tests for new nested beans element support in Spring XML
|
||||||
*
|
*
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
*/
|
*/
|
||||||
class NestedBeansElementTests {
|
class NestedBeansElementTests {
|
||||||
private final Resource XML =
|
|
||||||
new ClassPathResource("NestedBeansElementTests-context.xml", this.getClass());
|
private final Resource XML = new ClassPathResource("NestedBeansElementTests-context.xml", getClass());
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getBean_withoutActiveProfile() {
|
void getBean_withoutActiveProfile() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -130,7 +130,7 @@ class SimpleKeyGeneratorTests {
|
||||||
|
|
||||||
|
|
||||||
private Object generateKey(Object[] arguments) {
|
private Object generateKey(Object[] arguments) {
|
||||||
Method method = ReflectionUtils.findMethod(this.getClass(), "generateKey", Object[].class);
|
Method method = ReflectionUtils.findMethod(getClass(), "generateKey", Object[].class);
|
||||||
return this.generator.generate(this, method, arguments);
|
return this.generator.generate(this, method, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ class PropertySourcesPlaceholderConfigurerTests {
|
||||||
.getBeanDefinition());
|
.getBeanDefinition());
|
||||||
|
|
||||||
PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
|
PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
|
||||||
Resource resource = new ClassPathResource("PropertySourcesPlaceholderConfigurerTests.properties", this.getClass());
|
Resource resource = new ClassPathResource("PropertySourcesPlaceholderConfigurerTests.properties", getClass());
|
||||||
ppc.setLocation(resource);
|
ppc.setLocation(resource);
|
||||||
ppc.postProcessBeanFactory(bf);
|
ppc.postProcessBeanFactory(bf);
|
||||||
assertThat(bf.getBean(TestBean.class).getName()).isEqualTo("foo");
|
assertThat(bf.getBean(TestBean.class).getName()).isEqualTo("foo");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -81,7 +81,7 @@ public abstract class AbstractTypeReference implements TypeReference {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(TypeReference other) {
|
public int compareTo(TypeReference other) {
|
||||||
return this.getCanonicalName().compareToIgnoreCase(other.getCanonicalName());
|
return getCanonicalName().compareToIgnoreCase(other.getCanonicalName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -198,7 +198,7 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
|
||||||
public void validateRequiredProperties() {
|
public void validateRequiredProperties() {
|
||||||
MissingRequiredPropertiesException ex = new MissingRequiredPropertiesException();
|
MissingRequiredPropertiesException ex = new MissingRequiredPropertiesException();
|
||||||
for (String key : this.requiredProperties) {
|
for (String key : this.requiredProperties) {
|
||||||
if (this.getProperty(key) == null) {
|
if (getProperty(key) == null) {
|
||||||
ex.addMissingRequiredProperty(key);
|
ex.addMissingRequiredProperty(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -228,7 +228,7 @@ class ClassUtilsTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getShortNameAsProperty() {
|
void getShortNameAsProperty() {
|
||||||
String shortName = ClassUtils.getShortNameAsProperty(this.getClass());
|
String shortName = ClassUtils.getShortNameAsProperty(getClass());
|
||||||
assertThat(shortName).as("Class name did not match").isEqualTo("classUtilsTests");
|
assertThat(shortName).as("Class name did not match").isEqualTo("classUtilsTests");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -382,7 +382,7 @@ class CollectionUtilsTests {
|
||||||
if (this == rhs) {
|
if (this == rhs) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (rhs == null || this.getClass() != rhs.getClass()) {
|
if (rhs == null || getClass() != rhs.getClass()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Instance instance = (Instance) rhs;
|
Instance instance = (Instance) rhs;
|
||||||
|
|
|
@ -276,7 +276,7 @@ class VariableAndFunctionTests extends AbstractExpressionTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void functionMethodMustBeStatic() throws Exception {
|
void functionMethodMustBeStatic() throws Exception {
|
||||||
context.registerFunction("nonStatic", this.getClass().getMethod("nonStatic"));
|
context.registerFunction("nonStatic", getClass().getMethod("nonStatic"));
|
||||||
SpelExpression expression = parser.parseRaw("#nonStatic()");
|
SpelExpression expression = parser.parseRaw("#nonStatic()");
|
||||||
assertThatExceptionOfType(SpelEvaluationException.class)
|
assertThatExceptionOfType(SpelEvaluationException.class)
|
||||||
.isThrownBy(() -> expression.getValue(context))
|
.isThrownBy(() -> expression.getValue(context))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -174,7 +174,7 @@ class MappingJackson2MessageConverterTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void toTextMessageWithReturnType() throws JMSException, NoSuchMethodException {
|
void toTextMessageWithReturnType() throws JMSException, NoSuchMethodException {
|
||||||
Method method = this.getClass().getDeclaredMethod("summary");
|
Method method = getClass().getDeclaredMethod("summary");
|
||||||
MethodParameter returnType = new MethodParameter(method, -1);
|
MethodParameter returnType = new MethodParameter(method, -1);
|
||||||
testToTextMessageWithReturnType(returnType);
|
testToTextMessageWithReturnType(returnType);
|
||||||
verify(sessionMock).createTextMessage("{\"name\":\"test\"}");
|
verify(sessionMock).createTextMessage("{\"name\":\"test\"}");
|
||||||
|
@ -188,7 +188,7 @@ class MappingJackson2MessageConverterTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void toTextMessageWithReturnTypeAndNoJsonView() throws JMSException, NoSuchMethodException {
|
void toTextMessageWithReturnTypeAndNoJsonView() throws JMSException, NoSuchMethodException {
|
||||||
Method method = this.getClass().getDeclaredMethod("none");
|
Method method = getClass().getDeclaredMethod("none");
|
||||||
MethodParameter returnType = new MethodParameter(method, -1);
|
MethodParameter returnType = new MethodParameter(method, -1);
|
||||||
|
|
||||||
testToTextMessageWithReturnType(returnType);
|
testToTextMessageWithReturnType(returnType);
|
||||||
|
@ -197,7 +197,7 @@ class MappingJackson2MessageConverterTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void toTextMessageWithReturnTypeAndMultipleJsonViews() throws NoSuchMethodException {
|
void toTextMessageWithReturnTypeAndMultipleJsonViews() throws NoSuchMethodException {
|
||||||
Method method = this.getClass().getDeclaredMethod("invalid");
|
Method method = getClass().getDeclaredMethod("invalid");
|
||||||
MethodParameter returnType = new MethodParameter(method, -1);
|
MethodParameter returnType = new MethodParameter(method, -1);
|
||||||
|
|
||||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -59,9 +59,9 @@ import static org.mockito.Mockito.verify;
|
||||||
* @author Sebastien Deleuze
|
* @author Sebastien Deleuze
|
||||||
*/
|
*/
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
public class SubscriptionMethodReturnValueHandlerTests {
|
class SubscriptionMethodReturnValueHandlerTests {
|
||||||
|
|
||||||
public static final MimeType MIME_TYPE = new MimeType("text", "plain", StandardCharsets.UTF_8);
|
private static final MimeType MIME_TYPE = new MimeType("text", "plain", StandardCharsets.UTF_8);
|
||||||
|
|
||||||
private static final String PAYLOAD = "payload";
|
private static final String PAYLOAD = "payload";
|
||||||
|
|
||||||
|
@ -95,16 +95,16 @@ public class SubscriptionMethodReturnValueHandlerTests {
|
||||||
jsonMessagingTemplate.setMessageConverter(new MappingJackson2MessageConverter());
|
jsonMessagingTemplate.setMessageConverter(new MappingJackson2MessageConverter());
|
||||||
this.jsonHandler = new SubscriptionMethodReturnValueHandler(jsonMessagingTemplate);
|
this.jsonHandler = new SubscriptionMethodReturnValueHandler(jsonMessagingTemplate);
|
||||||
|
|
||||||
Method method = this.getClass().getDeclaredMethod("getData");
|
Method method = getClass().getDeclaredMethod("getData");
|
||||||
this.subscribeEventReturnType = new MethodParameter(method, -1);
|
this.subscribeEventReturnType = new MethodParameter(method, -1);
|
||||||
|
|
||||||
method = this.getClass().getDeclaredMethod("getDataAndSendTo");
|
method = getClass().getDeclaredMethod("getDataAndSendTo");
|
||||||
this.subscribeEventSendToReturnType = new MethodParameter(method, -1);
|
this.subscribeEventSendToReturnType = new MethodParameter(method, -1);
|
||||||
|
|
||||||
method = this.getClass().getDeclaredMethod("handle");
|
method = getClass().getDeclaredMethod("handle");
|
||||||
this.messageMappingReturnType = new MethodParameter(method, -1);
|
this.messageMappingReturnType = new MethodParameter(method, -1);
|
||||||
|
|
||||||
method = this.getClass().getDeclaredMethod("getJsonView");
|
method = getClass().getDeclaredMethod("getJsonView");
|
||||||
this.subscribeEventJsonViewReturnType = new MethodParameter(method, -1);
|
this.subscribeEventJsonViewReturnType = new MethodParameter(method, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ public class SubscriptionMethodReturnValueHandlerTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
public void testHeadersPassedToMessagingTemplate() throws Exception {
|
void testHeadersPassedToMessagingTemplate() throws Exception {
|
||||||
String sessionId = "sess1";
|
String sessionId = "sess1";
|
||||||
String subscriptionId = "subs1";
|
String subscriptionId = "subs1";
|
||||||
String destination = "/dest";
|
String destination = "/dest";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -110,7 +110,7 @@ public class PersonEntity extends PersistentEntity implements Person {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
return new ToStringCreator(this)
|
return new ToStringCreator(this)
|
||||||
.append("id", this.getId())
|
.append("id", getId())
|
||||||
.append("name", this.name)
|
.append("name", this.name)
|
||||||
.append("age", this.age)
|
.append("age", this.age)
|
||||||
.append("eyeColor", this.eyeColor)
|
.append("eyeColor", this.eyeColor)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -19,7 +19,6 @@ package org.springframework.test.web.client.samples;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
@ -46,27 +45,22 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Examples to demonstrate writing client-side REST tests with Spring MVC Test.
|
* Examples to demonstrate writing client-side REST tests with Spring MVC Test.
|
||||||
* While the tests in this class invoke the RestTemplate directly, in actual
|
*
|
||||||
|
* <p>While the tests in this class invoke the RestTemplate directly, in actual
|
||||||
* tests the RestTemplate may likely be invoked indirectly, i.e. through client
|
* tests the RestTemplate may likely be invoked indirectly, i.e. through client
|
||||||
* code.
|
* code.
|
||||||
*
|
*
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
*/
|
*/
|
||||||
public class SampleTests {
|
class SampleTests {
|
||||||
|
|
||||||
private MockRestServiceServer mockServer;
|
private final RestTemplate restTemplate = new RestTemplate();
|
||||||
|
|
||||||
private RestTemplate restTemplate;
|
private final MockRestServiceServer mockServer = MockRestServiceServer.bindTo(this.restTemplate).ignoreExpectOrder(true).build();
|
||||||
|
|
||||||
@BeforeEach
|
|
||||||
public void setup() {
|
|
||||||
this.restTemplate = new RestTemplate();
|
|
||||||
this.mockServer = MockRestServiceServer.bindTo(this.restTemplate).ignoreExpectOrder(true).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void performGet() {
|
void performGet() {
|
||||||
|
|
||||||
String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}";
|
String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}";
|
||||||
|
|
||||||
this.mockServer.expect(requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
|
this.mockServer.expect(requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
|
||||||
|
@ -83,8 +77,7 @@ public class SampleTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void performGetManyTimes() {
|
void performGetManyTimes() {
|
||||||
|
|
||||||
String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}";
|
String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}";
|
||||||
|
|
||||||
this.mockServer.expect(manyTimes(), requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
|
this.mockServer.expect(manyTimes(), requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
|
||||||
|
@ -105,8 +98,7 @@ public class SampleTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void expectNever() {
|
void expectNever() {
|
||||||
|
|
||||||
String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}";
|
String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}";
|
||||||
|
|
||||||
this.mockServer.expect(once(), requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
|
this.mockServer.expect(once(), requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
|
||||||
|
@ -120,8 +112,7 @@ public class SampleTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void expectNeverViolated() {
|
void expectNeverViolated() {
|
||||||
|
|
||||||
String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}";
|
String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}";
|
||||||
|
|
||||||
this.mockServer.expect(once(), requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
|
this.mockServer.expect(once(), requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
|
||||||
|
@ -135,9 +126,8 @@ public class SampleTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void performGetWithResponseBodyFromFile() {
|
void performGetWithResponseBodyFromFile() {
|
||||||
|
Resource responseBody = new ClassPathResource("ludwig.json", getClass());
|
||||||
Resource responseBody = new ClassPathResource("ludwig.json", this.getClass());
|
|
||||||
|
|
||||||
this.mockServer.expect(requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
|
this.mockServer.expect(requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
|
||||||
.andRespond(withSuccess(responseBody, MediaType.APPLICATION_JSON));
|
.andRespond(withSuccess(responseBody, MediaType.APPLICATION_JSON));
|
||||||
|
@ -152,8 +142,7 @@ public class SampleTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void verify() {
|
void verify() {
|
||||||
|
|
||||||
this.mockServer.expect(requestTo("/number")).andExpect(method(HttpMethod.GET))
|
this.mockServer.expect(requestTo("/number")).andExpect(method(HttpMethod.GET))
|
||||||
.andRespond(withSuccess("1", MediaType.TEXT_PLAIN));
|
.andRespond(withSuccess("1", MediaType.TEXT_PLAIN));
|
||||||
|
|
||||||
|
@ -183,9 +172,8 @@ public class SampleTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // SPR-14694
|
@Test // SPR-14694
|
||||||
public void repeatedAccessToResponseViaResource() {
|
void repeatedAccessToResponseViaResource() {
|
||||||
|
Resource resource = new ClassPathResource("ludwig.json", getClass());
|
||||||
Resource resource = new ClassPathResource("ludwig.json", this.getClass());
|
|
||||||
|
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
restTemplate.setInterceptors(Collections.singletonList(new ContentInterceptor(resource)));
|
restTemplate.setInterceptors(Collections.singletonList(new ContentInterceptor(resource)));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -257,7 +257,7 @@ class PrintingResultHandlerTests {
|
||||||
this.mvcResult.setHandler(handlerMethod);
|
this.mvcResult.setHandler(handlerMethod);
|
||||||
this.handler.handle(mvcResult);
|
this.handler.handle(mvcResult);
|
||||||
|
|
||||||
assertValue("Handler", "Type", this.getClass().getName());
|
assertValue("Handler", "Type", getClass().getName());
|
||||||
assertValue("Handler", "Method", handlerMethod);
|
assertValue("Handler", "Method", handlerMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2022 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -69,7 +69,7 @@ public class HttpMediaTypeNotAcceptableException extends HttpMediaTypeException
|
||||||
return HttpHeaders.EMPTY;
|
return HttpHeaders.EMPTY;
|
||||||
}
|
}
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.setAccept(this.getSupportedMediaTypes());
|
headers.setAccept(getSupportedMediaTypes());
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -237,7 +237,7 @@ public class InMemoryWebSessionStore implements WebSessionStore {
|
||||||
InMemoryWebSessionStore.this.sessions.remove(currentId);
|
InMemoryWebSessionStore.this.sessions.remove(currentId);
|
||||||
String newId = String.valueOf(idGenerator.generateId());
|
String newId = String.valueOf(idGenerator.generateId());
|
||||||
this.id.set(newId);
|
this.id.set(newId);
|
||||||
InMemoryWebSessionStore.this.sessions.put(this.getId(), this);
|
InMemoryWebSessionStore.this.sessions.put(this.id.get(), this);
|
||||||
return Mono.empty();
|
return Mono.empty();
|
||||||
})
|
})
|
||||||
.subscribeOn(Schedulers.boundedElastic())
|
.subscribeOn(Schedulers.boundedElastic())
|
||||||
|
@ -266,11 +266,11 @@ public class InMemoryWebSessionStore implements WebSessionStore {
|
||||||
|
|
||||||
if (isStarted()) {
|
if (isStarted()) {
|
||||||
// Save
|
// Save
|
||||||
InMemoryWebSessionStore.this.sessions.put(this.getId(), this);
|
InMemoryWebSessionStore.this.sessions.put(this.id.get(), this);
|
||||||
|
|
||||||
// Unless it was invalidated
|
// Unless it was invalidated
|
||||||
if (this.state.get().equals(State.EXPIRED)) {
|
if (this.state.get().equals(State.EXPIRED)) {
|
||||||
InMemoryWebSessionStore.this.sessions.remove(this.getId());
|
InMemoryWebSessionStore.this.sessions.remove(this.id.get());
|
||||||
return Mono.error(new IllegalStateException("Session was invalidated"));
|
return Mono.error(new IllegalStateException("Session was invalidated"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -2040,7 +2040,7 @@ final class WhatWgUrlParser {
|
||||||
if (obj == this) {
|
if (obj == this) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj == null || obj.getClass() != this.getClass()) {
|
if (obj == null || getClass() != obj.getClass()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
UrlRecord that = (UrlRecord) obj;
|
UrlRecord that = (UrlRecord) obj;
|
||||||
|
@ -2322,7 +2322,7 @@ final class WhatWgUrlParser {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
return obj == this || obj != null && obj.getClass() == this.getClass();
|
return obj == this || obj != null && getClass() == obj.getClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -435,7 +435,7 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||||
if (this.endsWithSeparatorWildcard) {
|
if (this.endsWithSeparatorWildcard) {
|
||||||
String prefix = this.patternString.length() > 2 ?
|
String prefix = this.patternString.length() > 2 ?
|
||||||
this.patternString.substring(0, this.patternString.length() - 2) :
|
this.patternString.substring(0, this.patternString.length() - 2) :
|
||||||
String.valueOf(this.getSeparator());
|
String.valueOf(getSeparator());
|
||||||
return this.parser.parse(concat(prefix, otherPattern.patternString));
|
return this.parser.parse(concat(prefix, otherPattern.patternString));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,8 +465,8 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||||
"Cannot combine patterns: " + this.patternString + " and " + otherPattern);
|
"Cannot combine patterns: " + this.patternString + " and " + otherPattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
String firstPath = this.patternString.substring(0, this.patternString.lastIndexOf(this.getSeparator()));
|
String firstPath = this.patternString.substring(0, this.patternString.lastIndexOf(getSeparator()));
|
||||||
String secondPath = otherPattern.patternString.substring(0, otherPattern.patternString.lastIndexOf(this.getSeparator()));
|
String secondPath = otherPattern.patternString.substring(0, otherPattern.patternString.lastIndexOf(getSeparator()));
|
||||||
if (!this.parser.parse(firstPath).matches(PathContainer.parsePath(secondPath))) {
|
if (!this.parser.parse(firstPath).matches(PathContainer.parsePath(secondPath))) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Cannot combine patterns: " + this.patternString + " and " + otherPattern);
|
"Cannot combine patterns: " + this.patternString + " and " + otherPattern);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -615,7 +615,7 @@ class Jackson2ObjectMapperBuilderTests {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModuleName() {
|
public String getModuleName() {
|
||||||
return this.getClass().getSimpleName();
|
return getClass().getSimpleName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -358,7 +358,7 @@ public class Jackson2ObjectMapperFactoryBeanTests {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModuleName() {
|
public String getModuleName() {
|
||||||
return this.getClass().getSimpleName();
|
return getClass().getSimpleName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -47,7 +47,7 @@ class CompositeUriComponentsContributorTests {
|
||||||
resolvers.add(new RequestParamMethodArgumentResolver(true));
|
resolvers.add(new RequestParamMethodArgumentResolver(true));
|
||||||
|
|
||||||
CompositeUriComponentsContributor contributor = new CompositeUriComponentsContributor(resolvers);
|
CompositeUriComponentsContributor contributor = new CompositeUriComponentsContributor(resolvers);
|
||||||
Method method = ClassUtils.getMethod(this.getClass(), "handleRequest", String.class, String.class, String.class);
|
Method method = ClassUtils.getMethod(getClass(), "handleRequest", String.class, String.class, String.class);
|
||||||
assertThat(contributor.supportsParameter(new MethodParameter(method, 0))).isTrue();
|
assertThat(contributor.supportsParameter(new MethodParameter(method, 0))).isTrue();
|
||||||
assertThat(contributor.supportsParameter(new MethodParameter(method, 1))).isTrue();
|
assertThat(contributor.supportsParameter(new MethodParameter(method, 1))).isTrue();
|
||||||
assertThat(contributor.supportsParameter(new MethodParameter(method, 2))).isFalse();
|
assertThat(contributor.supportsParameter(new MethodParameter(method, 2))).isFalse();
|
||||||
|
|
|
@ -428,7 +428,9 @@ public class ResourceWebHandler implements WebHandler, InitializingBean {
|
||||||
public Mono<Void> handle(ServerWebExchange exchange) {
|
public Mono<Void> handle(ServerWebExchange exchange) {
|
||||||
return getResource(exchange)
|
return getResource(exchange)
|
||||||
.switchIfEmpty(Mono.defer(() -> {
|
.switchIfEmpty(Mono.defer(() -> {
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug(exchange.getLogPrefix() + "Resource not found");
|
logger.debug(exchange.getLogPrefix() + "Resource not found");
|
||||||
|
}
|
||||||
return Mono.error(new NoResourceFoundException(getResourcePath(exchange)));
|
return Mono.error(new NoResourceFoundException(getResourcePath(exchange)));
|
||||||
}))
|
}))
|
||||||
.flatMap(resource -> {
|
.flatMap(resource -> {
|
||||||
|
@ -446,10 +448,12 @@ public class ResourceWebHandler implements WebHandler, InitializingBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header phase
|
// Header phase
|
||||||
String eTagValue = (this.getEtagGenerator() != null) ? this.getEtagGenerator().apply(resource) : null;
|
String eTagValue = (getEtagGenerator() != null) ? getEtagGenerator().apply(resource) : null;
|
||||||
Instant lastModified = isUseLastModified() ? Instant.ofEpochMilli(resource.lastModified()) : Instant.MIN;
|
Instant lastModified = isUseLastModified() ? Instant.ofEpochMilli(resource.lastModified()) : Instant.MIN;
|
||||||
if (exchange.checkNotModified(eTagValue, lastModified)) {
|
if (exchange.checkNotModified(eTagValue, lastModified)) {
|
||||||
|
if (logger.isTraceEnabled()) {
|
||||||
logger.trace(exchange.getLogPrefix() + "Resource not modified");
|
logger.trace(exchange.getLogPrefix() + "Resource not modified");
|
||||||
|
}
|
||||||
return Mono.empty();
|
return Mono.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -52,7 +52,7 @@ class MatrixVariablesMapMethodArgumentResolverTests {
|
||||||
|
|
||||||
private final MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/"));
|
private final MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/"));
|
||||||
|
|
||||||
private final ResolvableMethod testMethod = ResolvableMethod.on(this.getClass()).named("handle").build();
|
private final ResolvableMethod testMethod = ResolvableMethod.on(getClass()).named("handle").build();
|
||||||
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -54,7 +54,7 @@ class MatrixVariablesMethodArgumentResolverTests {
|
||||||
|
|
||||||
private final MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/"));
|
private final MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/"));
|
||||||
|
|
||||||
private ResolvableMethod testMethod = ResolvableMethod.on(this.getClass()).named("handle").build();
|
private ResolvableMethod testMethod = ResolvableMethod.on(getClass()).named("handle").build();
|
||||||
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
|
@ -65,7 +65,6 @@ class MatrixVariablesMethodArgumentResolverTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void supportsParameter() {
|
void supportsParameter() {
|
||||||
|
|
||||||
assertThat(this.resolver.supportsParameter(this.testMethod.arg(String.class))).isFalse();
|
assertThat(this.resolver.supportsParameter(this.testMethod.arg(String.class))).isFalse();
|
||||||
|
|
||||||
assertThat(this.resolver.supportsParameter(this.testMethod
|
assertThat(this.resolver.supportsParameter(this.testMethod
|
||||||
|
|
|
@ -597,8 +597,8 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
||||||
prepareResponse(response);
|
prepareResponse(response);
|
||||||
|
|
||||||
// Header phase
|
// Header phase
|
||||||
String eTagValue = (this.getEtagGenerator() != null) ? this.getEtagGenerator().apply(resource) : null;
|
String eTagValue = (getEtagGenerator() != null ? getEtagGenerator().apply(resource) : null);
|
||||||
long lastModified = (this.isUseLastModified()) ? resource.lastModified() : -1;
|
long lastModified = (isUseLastModified() ? resource.lastModified() : -1);
|
||||||
if (new ServletWebRequest(request, response).checkNotModified(eTagValue, lastModified)) {
|
if (new ServletWebRequest(request, response).checkNotModified(eTagValue, lastModified)) {
|
||||||
logger.trace("Resource not modified");
|
logger.trace("Resource not modified");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -54,7 +54,7 @@ class MatrixVariablesMapMethodArgumentResolverTests {
|
||||||
|
|
||||||
private MockHttpServletRequest request;
|
private MockHttpServletRequest request;
|
||||||
|
|
||||||
private final ResolvableMethod testMethod = ResolvableMethod.on(this.getClass()).named("handle").build();
|
private final ResolvableMethod testMethod = ResolvableMethod.on(getClass()).named("handle").build();
|
||||||
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -54,7 +54,7 @@ class MatrixVariablesMethodArgumentResolverTests {
|
||||||
|
|
||||||
private MockHttpServletRequest request;
|
private MockHttpServletRequest request;
|
||||||
|
|
||||||
private ResolvableMethod testMethod = ResolvableMethod.on(this.getClass()).named("handle").build();
|
private ResolvableMethod testMethod = ResolvableMethod.on(getClass()).named("handle").build();
|
||||||
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -62,8 +62,8 @@ class RequestResponseBodyAdviceChainTests {
|
||||||
|
|
||||||
private Class<? extends HttpMessageConverter<?>> converterType = StringHttpMessageConverter.class;
|
private Class<? extends HttpMessageConverter<?>> converterType = StringHttpMessageConverter.class;
|
||||||
|
|
||||||
private MethodParameter paramType = new MethodParameter(ClassUtils.getMethod(this.getClass(), "handle", String.class), 0);
|
private MethodParameter paramType = new MethodParameter(ClassUtils.getMethod(getClass(), "handle", String.class), 0);
|
||||||
private MethodParameter returnType = new MethodParameter(ClassUtils.getMethod(this.getClass(), "handle", String.class), -1);
|
private MethodParameter returnType = new MethodParameter(ClassUtils.getMethod(getClass(), "handle", String.class), -1);
|
||||||
|
|
||||||
private ServerHttpRequest request = new ServletServerHttpRequest(new MockHttpServletRequest());
|
private ServerHttpRequest request = new ServletServerHttpRequest(new MockHttpServletRequest());
|
||||||
private ServerHttpResponse response = new ServletServerHttpResponse(new MockHttpServletResponse());
|
private ServerHttpResponse response = new ServletServerHttpResponse(new MockHttpServletResponse());
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -54,7 +54,7 @@ class UriComponentsBuilderMethodArgumentResolverTests {
|
||||||
this.servletRequest = new MockHttpServletRequest();
|
this.servletRequest = new MockHttpServletRequest();
|
||||||
this.webRequest = new ServletWebRequest(this.servletRequest);
|
this.webRequest = new ServletWebRequest(this.servletRequest);
|
||||||
|
|
||||||
Method method = this.getClass().getDeclaredMethod(
|
Method method = getClass().getDeclaredMethod(
|
||||||
"handle", UriComponentsBuilder.class, ServletUriComponentsBuilder.class, int.class);
|
"handle", UriComponentsBuilder.class, ServletUriComponentsBuilder.class, int.class);
|
||||||
this.builderParam = new MethodParameter(method, 0);
|
this.builderParam = new MethodParameter(method, 0);
|
||||||
this.servletBuilderParam = new MethodParameter(method, 1);
|
this.servletBuilderParam = new MethodParameter(method, 1);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -175,7 +175,7 @@ class DefaultHandlerExceptionResolverTests {
|
||||||
void handleMethodArgumentNotValid() throws Exception {
|
void handleMethodArgumentNotValid() throws Exception {
|
||||||
BeanPropertyBindingResult errors = new BeanPropertyBindingResult(new TestBean(), "testBean");
|
BeanPropertyBindingResult errors = new BeanPropertyBindingResult(new TestBean(), "testBean");
|
||||||
errors.rejectValue("name", "invalid");
|
errors.rejectValue("name", "invalid");
|
||||||
MethodParameter parameter = new MethodParameter(this.getClass().getMethod("handle", String.class), 0);
|
MethodParameter parameter = new MethodParameter(getClass().getMethod("handle", String.class), 0);
|
||||||
MethodArgumentNotValidException ex = new MethodArgumentNotValidException(parameter, errors);
|
MethodArgumentNotValidException ex = new MethodArgumentNotValidException(parameter, errors);
|
||||||
ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
|
ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
|
||||||
assertThat(mav).as("No ModelAndView returned").isNotNull();
|
assertThat(mav).as("No ModelAndView returned").isNotNull();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -117,7 +117,7 @@ class InputTagTests extends AbstractFormTagTests {
|
||||||
final String NAME = "Rob \"I Love Cafés\" Harrop";
|
final String NAME = "Rob \"I Love Cafés\" Harrop";
|
||||||
final String HTML_ESCAPED_NAME = "Rob "I Love Cafés" Harrop";
|
final String HTML_ESCAPED_NAME = "Rob "I Love Cafés" Harrop";
|
||||||
|
|
||||||
this.getPageContext().getResponse().setCharacterEncoding("UTF-8");
|
getPageContext().getResponse().setCharacterEncoding("UTF-8");
|
||||||
this.tag.setPath("name");
|
this.tag.setPath("name");
|
||||||
this.rob.setName(NAME);
|
this.rob.setName(NAME);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -33,9 +33,9 @@ class PasswordInputTagTests extends InputTagTests {
|
||||||
|
|
||||||
@Test // SPR-2866
|
@Test // SPR-2866
|
||||||
void passwordValueIsNotRenderedByDefault() throws Exception {
|
void passwordValueIsNotRenderedByDefault() throws Exception {
|
||||||
this.getTag().setPath("name");
|
getTag().setPath("name");
|
||||||
|
|
||||||
assertThat(this.getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
|
assertThat(getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
|
||||||
|
|
||||||
String output = getOutput();
|
String output = getOutput();
|
||||||
assertTagOpened(output);
|
assertTagOpened(output);
|
||||||
|
@ -47,10 +47,10 @@ class PasswordInputTagTests extends InputTagTests {
|
||||||
|
|
||||||
@Test // SPR-2866
|
@Test // SPR-2866
|
||||||
void passwordValueIsRenderedIfShowPasswordAttributeIsSetToTrue() throws Exception {
|
void passwordValueIsRenderedIfShowPasswordAttributeIsSetToTrue() throws Exception {
|
||||||
this.getTag().setPath("name");
|
getTag().setPath("name");
|
||||||
this.getPasswordTag().setShowPassword(true);
|
getPasswordTag().setShowPassword(true);
|
||||||
|
|
||||||
assertThat(this.getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
|
assertThat(getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
|
||||||
|
|
||||||
String output = getOutput();
|
String output = getOutput();
|
||||||
assertTagOpened(output);
|
assertTagOpened(output);
|
||||||
|
@ -62,10 +62,10 @@ class PasswordInputTagTests extends InputTagTests {
|
||||||
|
|
||||||
@Test // >SPR-2866
|
@Test // >SPR-2866
|
||||||
void passwordValueIsNotRenderedIfShowPasswordAttributeIsSetToFalse() throws Exception {
|
void passwordValueIsNotRenderedIfShowPasswordAttributeIsSetToFalse() throws Exception {
|
||||||
this.getTag().setPath("name");
|
getTag().setPath("name");
|
||||||
this.getPasswordTag().setShowPassword(false);
|
getPasswordTag().setShowPassword(false);
|
||||||
|
|
||||||
assertThat(this.getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
|
assertThat(getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
|
||||||
|
|
||||||
String output = getOutput();
|
String output = getOutput();
|
||||||
assertTagOpened(output);
|
assertTagOpened(output);
|
||||||
|
@ -78,14 +78,14 @@ class PasswordInputTagTests extends InputTagTests {
|
||||||
@Test
|
@Test
|
||||||
@Override
|
@Override
|
||||||
public void dynamicTypeAttribute() {
|
public void dynamicTypeAttribute() {
|
||||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
assertThatIllegalArgumentException()
|
||||||
this.getTag().setDynamicAttribute(null, "type", "email"))
|
.isThrownBy(() -> getTag().setDynamicAttribute(null, "type", "email"))
|
||||||
.withMessage("Attribute type=\"email\" is not allowed");
|
.withMessage("Attribute type=\"email\" is not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void assertValueAttribute(String output, String expectedValue) {
|
protected void assertValueAttribute(String output, String expectedValue) {
|
||||||
if (this.getPasswordTag().isShowPassword()) {
|
if (getPasswordTag().isShowPassword()) {
|
||||||
super.assertValueAttribute(output, expectedValue);
|
super.assertValueAttribute(output, expectedValue);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -110,7 +110,7 @@ class PasswordInputTagTests extends InputTagTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
private PasswordInputTag getPasswordTag() {
|
private PasswordInputTag getPasswordTag() {
|
||||||
return (PasswordInputTag) this.getTag();
|
return (PasswordInputTag) getTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue