From 34ed7a5e2262a0999b41215aa8f805c32780245b Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:20:29 +0200 Subject: [PATCH] Test correct scenarios in tests --- .../web/servlet/result/MockMvcResultMatchersTests.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/result/MockMvcResultMatchersTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/result/MockMvcResultMatchersTests.java index d734465c391..42570aa3d0f 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/result/MockMvcResultMatchersTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/result/MockMvcResultMatchersTests.java @@ -118,15 +118,15 @@ class MockMvcResultMatchersTests { @Test void forwardNonMatching() { assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> forwardedUrlPattern("api/resource/2").match(forwardedUrlStub("api/resource/1"))) - .withMessage("'api/resource/2' is not an Ant-style path pattern"); + .isThrownBy(() -> forwardedUrl("/api/resource/2").match(forwardedUrlStub("/api/resource/1"))) + .withMessageEndingWith("expected: but was:"); } @Test void forwardNonMatchingBecauseNotForward() { assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> forwardedUrlPattern("/resource/*").match(redirectedUrlStub("/resource/1"))) - .withMessage("Forwarded URL 'null' does not match the expected URL pattern '/resource/*'"); + .isThrownBy(() -> forwardedUrl("/resource/1").match(redirectedUrlStub("/resource/1"))) + .withMessageEndingWith("expected: but was:"); } @Test // gh-22155