diff --git a/core/src/test/java/org/springframework/security/jackson2/SecurityJackson2ModulesTests.java b/core/src/test/java/org/springframework/security/jackson2/SecurityJackson2ModulesTests.java index 22e95417e7..a625f8a551 100644 --- a/core/src/test/java/org/springframework/security/jackson2/SecurityJackson2ModulesTests.java +++ b/core/src/test/java/org/springframework/security/jackson2/SecurityJackson2ModulesTests.java @@ -26,6 +26,7 @@ import org.junit.Before; import org.junit.Test; import java.lang.annotation.*; +import java.util.HashMap; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; @@ -87,6 +88,14 @@ public class SecurityJackson2ModulesTests { assertThat(mapper.readValue(content, Object.class)).isInstanceOf(NotWhitelisted.class); } + @Test + public void readValueWhenHashMapThenReadsAsSpecificType() throws Exception { + mapper.addMixIn(NotWhitelisted.class, NotWhitelistedMixin.class); + String content = "{\"@class\":\"java.util.HashMap\"}"; + + assertThat(mapper.readValue(content, Object.class)).isInstanceOf(HashMap.class); + } + @Target({ ElementType.TYPE, ElementType.ANNOTATION_TYPE }) @Retention(RetentionPolicy.RUNTIME) @Documented