mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-21 11:32:17 +00:00
Test Jackson HashMap in Whitelist
Issue: gh-4889
This commit is contained in:
parent
cf97e16379
commit
803cdcf01e
@ -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.*;
|
||||
|
||||
@ -84,6 +85,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user