|
|
|
|
@ -26,6 +26,7 @@ import org.junit.Before;
@@ -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 {
@@ -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 |
|
|
|
|
|