Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details

This commit is contained in:
Sam Brannen 2025-06-09 14:12:45 +02:00
commit 077146d636
36 changed files with 122 additions and 130 deletions

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -24,7 +24,7 @@ import java.util.Map;
import org.jspecify.annotations.Nullable;
/**
* Abstract superclass for counting advices etc.
* Abstract superclass for counting advice, etc.
*
* @author Rod Johnson
* @author Chris Beams
@ -62,7 +62,7 @@ public class MethodCounter implements Serializable {
*/
@Override
public boolean equals(@Nullable Object other) {
return (other != null && other.getClass() == this.getClass());
return (other != null && getClass() == other.getClass());
}
@Override

View File

@ -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");
* 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
*/
class FactoryBeanLookupTests {
private BeanFactory beanFactory;
private final BeanFactory beanFactory = new DefaultListableBeanFactory();
@BeforeEach
void setUp() {
beanFactory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory).loadBeanDefinitions(
new ClassPathResource("FactoryBeanLookupTests-context.xml", this.getClass()));
new ClassPathResource("FactoryBeanLookupTests-context.xml", getClass()));
}
@Test
@ -71,6 +72,7 @@ class FactoryBeanLookupTests {
Foo foo = beanFactory.getBean("fooFactory", Foo.class);
assertThat(foo).isNotNull();
}
}
class FooFactoryBean extends AbstractFactoryBean<Foo> {

View File

@ -84,7 +84,7 @@ class PropertyPlaceholderConfigurerTests {
.getBeanDefinition());
PropertyPlaceholderConfigurer pc = new PropertyPlaceholderConfigurer();
Resource resource = new ClassPathResource("PropertyPlaceholderConfigurerTests.properties", this.getClass());
Resource resource = new ClassPathResource("PropertyPlaceholderConfigurerTests.properties", getClass());
pc.setLocation(resource);
pc.postProcessBeanFactory(bf);
}

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -46,7 +46,7 @@ class DuplicateBeanIdTests {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(bf);
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
@ -54,7 +54,7 @@ class DuplicateBeanIdTests {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.setAllowBeanDefinitionOverriding(true);
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
assertThat(testBean.getName()).isEqualTo("nested");
}

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -36,7 +36,7 @@ class NestedBeansElementAttributeRecursionTests {
void defaultLazyInit() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", this.getClass()));
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", getClass()));
assertLazyInits(bf);
}
@ -47,7 +47,7 @@ class NestedBeansElementAttributeRecursionTests {
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
xmlBeanDefinitionReader.setValidating(false);
xmlBeanDefinitionReader.loadBeanDefinitions(
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", this.getClass()));
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", getClass()));
assertLazyInits(bf);
}
@ -70,7 +70,7 @@ class NestedBeansElementAttributeRecursionTests {
void defaultMerge() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", this.getClass()));
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", getClass()));
assertMerge(bf);
}
@ -81,7 +81,7 @@ class NestedBeansElementAttributeRecursionTests {
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
xmlBeanDefinitionReader.setValidating(false);
xmlBeanDefinitionReader.loadBeanDefinitions(
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", this.getClass()));
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", getClass()));
assertMerge(bf);
}
@ -109,7 +109,7 @@ class NestedBeansElementAttributeRecursionTests {
void defaultAutowireCandidates() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", this.getClass()));
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", getClass()));
assertAutowireCandidates(bf);
}
@ -120,7 +120,7 @@ class NestedBeansElementAttributeRecursionTests {
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bf);
xmlBeanDefinitionReader.setValidating(false);
xmlBeanDefinitionReader.loadBeanDefinitions(
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", this.getClass()));
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", getClass()));
assertAutowireCandidates(bf);
}
@ -149,7 +149,7 @@ class NestedBeansElementAttributeRecursionTests {
void initMethod() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
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 beanB = bf.getBean("beanB", InitDestroyBean.class);

View File

@ -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");
* 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;
/**
* Tests for new nested beans element support in Spring XML
*
* @author Chris Beams
*/
class NestedBeansElementTests {
private final Resource XML =
new ClassPathResource("NestedBeansElementTests-context.xml", this.getClass());
private final Resource XML = new ClassPathResource("NestedBeansElementTests-context.xml", getClass());
@Test
void getBean_withoutActiveProfile() {

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -130,7 +130,7 @@ class SimpleKeyGeneratorTests {
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);
}

View File

@ -170,7 +170,7 @@ class PropertySourcesPlaceholderConfigurerTests {
.getBeanDefinition());
PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
Resource resource = new ClassPathResource("PropertySourcesPlaceholderConfigurerTests.properties", this.getClass());
Resource resource = new ClassPathResource("PropertySourcesPlaceholderConfigurerTests.properties", getClass());
ppc.setLocation(resource);
ppc.postProcessBeanFactory(bf);
assertThat(bf.getBean(TestBean.class).getName()).isEqualTo("foo");

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -79,7 +79,7 @@ public abstract class AbstractTypeReference implements TypeReference {
@Override
public int compareTo(TypeReference other) {
return this.getCanonicalName().compareToIgnoreCase(other.getCanonicalName());
return getCanonicalName().compareToIgnoreCase(other.getCanonicalName());
}
@Override

View File

@ -192,7 +192,7 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
public void validateRequiredProperties() {
MissingRequiredPropertiesException ex = new MissingRequiredPropertiesException();
for (String key : this.requiredProperties) {
if (this.getProperty(key) == null) {
if (getProperty(key) == null) {
ex.addMissingRequiredProperty(key);
}
}

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -228,7 +228,7 @@ class ClassUtilsTests {
@Test
void getShortNameAsProperty() {
String shortName = ClassUtils.getShortNameAsProperty(this.getClass());
String shortName = ClassUtils.getShortNameAsProperty(getClass());
assertThat(shortName).as("Class name did not match").isEqualTo("classUtilsTests");
}

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -383,7 +383,7 @@ class CollectionUtilsTests {
if (this == rhs) {
return true;
}
if (rhs == null || this.getClass() != rhs.getClass()) {
if (rhs == null || getClass() != rhs.getClass()) {
return false;
}
Instance instance = (Instance) rhs;

View File

@ -276,7 +276,7 @@ class VariableAndFunctionTests extends AbstractExpressionTests {
@Test
void functionMethodMustBeStatic() throws Exception {
context.registerFunction("nonStatic", this.getClass().getMethod("nonStatic"));
context.registerFunction("nonStatic", getClass().getMethod("nonStatic"));
SpelExpression expression = parser.parseRaw("#nonStatic()");
assertThatExceptionOfType(SpelEvaluationException.class)
.isThrownBy(() -> expression.getValue(context))

View File

@ -175,7 +175,7 @@ class MappingJackson2MessageConverterTests {
@Test
void toTextMessageWithReturnType() throws JMSException, NoSuchMethodException {
Method method = this.getClass().getDeclaredMethod("summary");
Method method = getClass().getDeclaredMethod("summary");
MethodParameter returnType = new MethodParameter(method, -1);
testToTextMessageWithReturnType(returnType);
verify(sessionMock).createTextMessage("{\"name\":\"test\"}");
@ -189,7 +189,7 @@ class MappingJackson2MessageConverterTests {
@Test
void toTextMessageWithReturnTypeAndNoJsonView() throws JMSException, NoSuchMethodException {
Method method = this.getClass().getDeclaredMethod("none");
Method method = getClass().getDeclaredMethod("none");
MethodParameter returnType = new MethodParameter(method, -1);
testToTextMessageWithReturnType(returnType);
@ -198,7 +198,7 @@ class MappingJackson2MessageConverterTests {
@Test
void toTextMessageWithReturnTypeAndMultipleJsonViews() throws NoSuchMethodException {
Method method = this.getClass().getDeclaredMethod("invalid");
Method method = getClass().getDeclaredMethod("invalid");
MethodParameter returnType = new MethodParameter(method, -1);
assertThatIllegalArgumentException().isThrownBy(() ->

View File

@ -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");
* 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
*/
@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";
@ -95,16 +95,16 @@ public class SubscriptionMethodReturnValueHandlerTests {
jsonMessagingTemplate.setMessageConverter(new JacksonJsonMessageConverter());
this.jsonHandler = new SubscriptionMethodReturnValueHandler(jsonMessagingTemplate);
Method method = this.getClass().getDeclaredMethod("getData");
Method method = getClass().getDeclaredMethod("getData");
this.subscribeEventReturnType = new MethodParameter(method, -1);
method = this.getClass().getDeclaredMethod("getDataAndSendTo");
method = getClass().getDeclaredMethod("getDataAndSendTo");
this.subscribeEventSendToReturnType = new MethodParameter(method, -1);
method = this.getClass().getDeclaredMethod("handle");
method = getClass().getDeclaredMethod("handle");
this.messageMappingReturnType = new MethodParameter(method, -1);
method = this.getClass().getDeclaredMethod("getJsonView");
method = getClass().getDeclaredMethod("getJsonView");
this.subscribeEventJsonViewReturnType = new MethodParameter(method, -1);
}
@ -144,7 +144,7 @@ public class SubscriptionMethodReturnValueHandlerTests {
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testHeadersPassedToMessagingTemplate() throws Exception {
void testHeadersPassedToMessagingTemplate() throws Exception {
String sessionId = "sess1";
String subscriptionId = "subs1";
String destination = "/dest";

View File

@ -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");
* 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() {
// @formatter:off
return new ToStringCreator(this)
.append("id", this.getId())
.append("id", getId())
.append("name", this.name)
.append("age", this.age)
.append("eyeColor", this.eyeColor)

View File

@ -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");
* 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.util.Collections;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
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.
* 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
* code.
*
* @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
public void performGet() {
void performGet() {
String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}";
this.mockServer.expect(requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
@ -83,8 +77,7 @@ public class SampleTests {
}
@Test
public void performGetManyTimes() {
void performGetManyTimes() {
String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}";
this.mockServer.expect(manyTimes(), requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
@ -105,8 +98,7 @@ public class SampleTests {
}
@Test
public void expectNever() {
void expectNever() {
String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}";
this.mockServer.expect(once(), requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
@ -120,8 +112,7 @@ public class SampleTests {
}
@Test
public void expectNeverViolated() {
void expectNeverViolated() {
String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}";
this.mockServer.expect(once(), requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
@ -135,9 +126,8 @@ public class SampleTests {
}
@Test
public void performGetWithResponseBodyFromFile() {
Resource responseBody = new ClassPathResource("ludwig.json", this.getClass());
void performGetWithResponseBodyFromFile() {
Resource responseBody = new ClassPathResource("ludwig.json", getClass());
this.mockServer.expect(requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
.andRespond(withSuccess(responseBody, MediaType.APPLICATION_JSON));
@ -152,8 +142,7 @@ public class SampleTests {
}
@Test
public void verify() {
void verify() {
this.mockServer.expect(requestTo("/number")).andExpect(method(HttpMethod.GET))
.andRespond(withSuccess("1", MediaType.TEXT_PLAIN));
@ -183,9 +172,8 @@ public class SampleTests {
}
@Test // SPR-14694
public void repeatedAccessToResponseViaResource() {
Resource resource = new ClassPathResource("ludwig.json", this.getClass());
void repeatedAccessToResponseViaResource() {
Resource resource = new ClassPathResource("ludwig.json", getClass());
RestTemplate restTemplate = new RestTemplate();
restTemplate.setInterceptors(Collections.singletonList(new ContentInterceptor(resource)));

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -257,7 +257,7 @@ class PrintingResultHandlerTests {
this.mvcResult.setHandler(handlerMethod);
this.handler.handle(mvcResult);
assertValue("Handler", "Type", this.getClass().getName());
assertValue("Handler", "Type", getClass().getName());
assertValue("Handler", "Method", handlerMethod);
}

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -69,7 +69,7 @@ public class HttpMediaTypeNotAcceptableException extends HttpMediaTypeException
return HttpHeaders.EMPTY;
}
HttpHeaders headers = new HttpHeaders();
headers.setAccept(this.getSupportedMediaTypes());
headers.setAccept(getSupportedMediaTypes());
return headers;
}

View File

@ -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");
* 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);
String newId = String.valueOf(idGenerator.generateId());
this.id.set(newId);
InMemoryWebSessionStore.this.sessions.put(this.getId(), this);
InMemoryWebSessionStore.this.sessions.put(this.id.get(), this);
return Mono.empty();
})
.subscribeOn(Schedulers.boundedElastic())
@ -266,11 +266,11 @@ public class InMemoryWebSessionStore implements WebSessionStore {
if (isStarted()) {
// Save
InMemoryWebSessionStore.this.sessions.put(this.getId(), this);
InMemoryWebSessionStore.this.sessions.put(this.id.get(), this);
// Unless it was invalidated
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"));
}
}

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -2023,7 +2023,7 @@ final class WhatWgUrlParser {
if (obj == this) {
return true;
}
if (obj == null || obj.getClass() != this.getClass()) {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
UrlRecord that = (UrlRecord) obj;
@ -2305,7 +2305,7 @@ final class WhatWgUrlParser {
@Override
public boolean equals(Object obj) {
return obj == this || obj != null && obj.getClass() == this.getClass();
return obj == this || obj != null && getClass() == obj.getClass();
}
@Override

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -425,7 +425,7 @@ public class PathPattern implements Comparable<PathPattern> {
if (this.endsWithSeparatorWildcard) {
String prefix = 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));
}
@ -455,8 +455,8 @@ public class PathPattern implements Comparable<PathPattern> {
"Cannot combine patterns: " + this.patternString + " and " + otherPattern);
}
String firstPath = this.patternString.substring(0, this.patternString.lastIndexOf(this.getSeparator()));
String secondPath = otherPattern.patternString.substring(0, otherPattern.patternString.lastIndexOf(this.getSeparator()));
String firstPath = this.patternString.substring(0, this.patternString.lastIndexOf(getSeparator()));
String secondPath = otherPattern.patternString.substring(0, otherPattern.patternString.lastIndexOf(getSeparator()));
if (!this.parser.parse(firstPath).matches(PathContainer.parsePath(secondPath))) {
throw new IllegalArgumentException(
"Cannot combine patterns: " + this.patternString + " and " + otherPattern);

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -615,7 +615,7 @@ class Jackson2ObjectMapperBuilderTests {
@Override
public String getModuleName() {
return this.getClass().getSimpleName();
return getClass().getSimpleName();
}
@Override

View File

@ -358,7 +358,7 @@ public class Jackson2ObjectMapperFactoryBeanTests {
@Override
public String getModuleName() {
return this.getClass().getSimpleName();
return getClass().getSimpleName();
}
@Override

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -47,7 +47,7 @@ class CompositeUriComponentsContributorTests {
resolvers.add(new RequestParamMethodArgumentResolver(true));
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, 1))).isTrue();
assertThat(contributor.supportsParameter(new MethodParameter(method, 2))).isFalse();

View File

@ -417,7 +417,9 @@ public class ResourceWebHandler implements WebHandler, InitializingBean {
public Mono<Void> handle(ServerWebExchange exchange) {
return getResource(exchange)
.switchIfEmpty(Mono.defer(() -> {
logger.debug(exchange.getLogPrefix() + "Resource not found");
if (logger.isDebugEnabled()) {
logger.debug(exchange.getLogPrefix() + "Resource not found");
}
return Mono.error(new NoResourceFoundException(getResourcePath(exchange)));
}))
.flatMap(resource -> {
@ -435,10 +437,12 @@ public class ResourceWebHandler implements WebHandler, InitializingBean {
}
// 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;
if (exchange.checkNotModified(eTagValue, lastModified)) {
logger.trace(exchange.getLogPrefix() + "Resource not modified");
if (logger.isTraceEnabled()) {
logger.trace(exchange.getLogPrefix() + "Resource not modified");
}
return Mono.empty();
}

View File

@ -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");
* 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 ResolvableMethod testMethod = ResolvableMethod.on(this.getClass()).named("handle").build();
private final ResolvableMethod testMethod = ResolvableMethod.on(getClass()).named("handle").build();
@BeforeEach

View File

@ -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");
* 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 ResolvableMethod testMethod = ResolvableMethod.on(this.getClass()).named("handle").build();
private ResolvableMethod testMethod = ResolvableMethod.on(getClass()).named("handle").build();
@BeforeEach
@ -65,7 +65,6 @@ class MatrixVariablesMethodArgumentResolverTests {
@Test
void supportsParameter() {
assertThat(this.resolver.supportsParameter(this.testMethod.arg(String.class))).isFalse();
assertThat(this.resolver.supportsParameter(this.testMethod

View File

@ -542,8 +542,8 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
prepareResponse(response);
// Header phase
String eTagValue = (this.getEtagGenerator() != null) ? this.getEtagGenerator().apply(resource) : null;
long lastModified = (this.isUseLastModified()) ? resource.lastModified() : -1;
String eTagValue = (getEtagGenerator() != null ? getEtagGenerator().apply(resource) : null);
long lastModified = (isUseLastModified() ? resource.lastModified() : -1);
if (new ServletWebRequest(request, response).checkNotModified(eTagValue, lastModified)) {
logger.trace("Resource not modified");
return;

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -54,7 +54,7 @@ class MatrixVariablesMapMethodArgumentResolverTests {
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

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -54,7 +54,7 @@ class MatrixVariablesMethodArgumentResolverTests {
private MockHttpServletRequest request;
private ResolvableMethod testMethod = ResolvableMethod.on(this.getClass()).named("handle").build();
private ResolvableMethod testMethod = ResolvableMethod.on(getClass()).named("handle").build();
@BeforeEach

View File

@ -69,8 +69,8 @@ class RequestResponseBodyAdviceChainTests {
private Class<? extends HttpMessageConverter<?>> converterType = StringHttpMessageConverter.class;
private MethodParameter paramType = new MethodParameter(ClassUtils.getMethod(this.getClass(), "handle", String.class), 0);
private MethodParameter returnType = new MethodParameter(ClassUtils.getMethod(this.getClass(), "handle", String.class), -1);
private MethodParameter paramType = new MethodParameter(ClassUtils.getMethod(getClass(), "handle", String.class), 0);
private MethodParameter returnType = new MethodParameter(ClassUtils.getMethod(getClass(), "handle", String.class), -1);
private ServerHttpRequest request = new ServletServerHttpRequest(new MockHttpServletRequest());
private ServerHttpResponse response = new ServletServerHttpResponse(new MockHttpServletResponse());

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -54,7 +54,7 @@ class UriComponentsBuilderMethodArgumentResolverTests {
this.servletRequest = new MockHttpServletRequest();
this.webRequest = new ServletWebRequest(this.servletRequest);
Method method = this.getClass().getDeclaredMethod(
Method method = getClass().getDeclaredMethod(
"handle", UriComponentsBuilder.class, ServletUriComponentsBuilder.class, int.class);
this.builderParam = new MethodParameter(method, 0);
this.servletBuilderParam = new MethodParameter(method, 1);

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -175,7 +175,7 @@ class DefaultHandlerExceptionResolverTests {
void handleMethodArgumentNotValid() throws Exception {
BeanPropertyBindingResult errors = new BeanPropertyBindingResult(new TestBean(), "testBean");
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);
ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
assertThat(mav).as("No ModelAndView returned").isNotNull();

View File

@ -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");
* 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 HTML_ESCAPED_NAME = "Rob &quot;I Love Cafés&quot; Harrop";
this.getPageContext().getResponse().setCharacterEncoding("UTF-8");
getPageContext().getResponse().setCharacterEncoding("UTF-8");
this.tag.setPath("name");
this.rob.setName(NAME);

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -33,9 +33,9 @@ class PasswordInputTagTests extends InputTagTests {
@Test // SPR-2866
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();
assertTagOpened(output);
@ -47,10 +47,10 @@ class PasswordInputTagTests extends InputTagTests {
@Test // SPR-2866
void passwordValueIsRenderedIfShowPasswordAttributeIsSetToTrue() throws Exception {
this.getTag().setPath("name");
this.getPasswordTag().setShowPassword(true);
getTag().setPath("name");
getPasswordTag().setShowPassword(true);
assertThat(this.getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
assertThat(getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
String output = getOutput();
assertTagOpened(output);
@ -62,10 +62,10 @@ class PasswordInputTagTests extends InputTagTests {
@Test // >SPR-2866
void passwordValueIsNotRenderedIfShowPasswordAttributeIsSetToFalse() throws Exception {
this.getTag().setPath("name");
this.getPasswordTag().setShowPassword(false);
getTag().setPath("name");
getPasswordTag().setShowPassword(false);
assertThat(this.getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
assertThat(getTag().doStartTag()).isEqualTo(Tag.SKIP_BODY);
String output = getOutput();
assertTagOpened(output);
@ -78,14 +78,14 @@ class PasswordInputTagTests extends InputTagTests {
@Test
@Override
public void dynamicTypeAttribute() {
assertThatIllegalArgumentException().isThrownBy(() ->
this.getTag().setDynamicAttribute(null, "type", "email"))
.withMessage("Attribute type=\"email\" is not allowed");
assertThatIllegalArgumentException()
.isThrownBy(() -> getTag().setDynamicAttribute(null, "type", "email"))
.withMessage("Attribute type=\"email\" is not allowed");
}
@Override
protected void assertValueAttribute(String output, String expectedValue) {
if (this.getPasswordTag().isShowPassword()) {
if (getPasswordTag().isShowPassword()) {
super.assertValueAttribute(output, expectedValue);
}
else {
@ -110,7 +110,7 @@ class PasswordInputTagTests extends InputTagTests {
}
private PasswordInputTag getPasswordTag() {
return (PasswordInputTag) this.getTag();
return (PasswordInputTag) getTag();
}
}