Merge branch '6.2.x'

This commit is contained in:
Brian Clozel
2025-01-29 16:15:16 +01:00
8 changed files with 35 additions and 31 deletions
@@ -27,6 +27,7 @@ import org.junit.jupiter.params.provider.ValueSource;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.testfixture.beans.TestBean;
import org.springframework.core.ResolvableType;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.BindParam;
import org.springframework.web.bind.support.BindParamNameResolver;
@@ -36,7 +37,7 @@ import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Test fixture for {@link ExtendedServletRequestDataBinder}.
* Tests for {@link ExtendedServletRequestDataBinder}.
*
* @author Rossen Stoyanchev
*/
@@ -136,6 +137,19 @@ class ExtendedServletRequestDataBinderTests {
assertThat(bean.someIntArray()).isNull();
}
@Test
void filteredPriorityHeaderForConstructorBinding() {
TestBinder binder = new TestBinder();
binder.setTargetType(ResolvableType.forClass(TestTarget.class));
request.addHeader("Priority", "u1");
binder.construct(request);
BindingResult result = binder.getBindingResult();
TestTarget target = (TestTarget) result.getTarget();
assertThat(target.priority).isNull();
}
@Test
void headerPredicate() {
TestBinder binder = new TestBinder();
@@ -179,4 +193,14 @@ class ExtendedServletRequestDataBinderTests {
}
}
static class TestTarget {
final String priority;
public TestTarget(String priority) {
this.priority = priority;
}
}
}
@@ -31,8 +31,6 @@ import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletResponse;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE;
import org.springframework.beans.testfixture.beans.TestBean;
import org.springframework.core.io.ClassPathResource;
@@ -145,12 +143,6 @@ public class FreeMarkerMacroTests {
assertThat(getMacroOutput("NAME")).isEqualTo("Darren");
}
@Test
@DisabledForJreRange(min = JRE.JAVA_21)
public void testAge() throws Exception {
assertThat(getMacroOutput("AGE")).isEqualTo("99");
}
@Test
void testMessage() throws Exception {
assertThat(getMacroOutput("MESSAGE")).isEqualTo("Howdy Mundo");