Quellcode durchsuchen

Polish ClientRegistrationsTests

Simplified the assertion so that it is focused on the core
behavior being verified. This will likely also make the test
more stable when updating Spring Framework versions.

Issue gh-16860
Josh Cummings vor 3 Monaten
Ursprung
Commit
f631a0fcd5

+ 3 - 7
oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTests.java

@@ -471,15 +471,11 @@ public class ClientRegistrationsTests {
 				return new MockResponse().setResponseCode(responseCode);
 			}
 		});
-		String message = """
-				Unable to resolve Configuration with the provided Issuer of "%s", errors: [\
-				405 Client Error: [no body], \
-				400 Client Error: [no body], \
-				404 Client Error: [no body]]\
-				""".formatted(this.issuer);
 		assertThatExceptionOfType(IllegalArgumentException.class)
 			.isThrownBy(() -> ClientRegistrations.fromIssuerLocation(this.issuer).build())
-			.withMessage(message);
+			.withMessageContaining("405")
+			.withMessageContaining("400")
+			.withMessageContaining("404");
 	}
 
 	private ClientRegistration.Builder registration(String path) throws Exception {