浏览代码

SavedCookieMixinTests uses readValue(String,Object.class)

The test should not provide SavedCookie.class to the ObjectMapper
since this is not done in production. In particular, it provides the
type that it should be deserialized, but this must be provided in the
JSON since the type is unknown at the time of deserialization.

Issue gh-17006
Rob Winch 3 月之前
父节点
当前提交
6118587ff8

+ 1 - 1
web/src/test/java/org/springframework/security/web/jackson2/SavedCookieMixinTests.java

@@ -88,7 +88,7 @@ public class SavedCookieMixinTests extends AbstractMixinTests {
 
 	@Test
 	public void deserializeSavedCookieJsonTest() throws IOException {
-		SavedCookie savedCookie = this.mapper.readValue(COOKIE_JSON, SavedCookie.class);
+		SavedCookie savedCookie = (SavedCookie) this.mapper.readValue(COOKIE_JSON, Object.class);
 		assertThat(savedCookie).isNotNull();
 		assertThat(savedCookie.getName()).isEqualTo("SESSION");
 		assertThat(savedCookie.getValue()).isEqualTo("123456789");