Search in sources :

Example 6 with ClassKey

use of com.fasterxml.jackson.databind.type.ClassKey in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class PageModuleProviderTest method testPageModule.

@Test
public void testPageModule() throws Exception {
    PageModuleProvider pmp = new PageModuleProvider();
    Module module = pmp.getModule();
    assertTrue(module instanceof SimpleModule);
    Field field = module.getClass().getDeclaredField("_serializers");
    field.setAccessible(true);
    SimpleSerializers simpleSerializers = (SimpleSerializers) field.get(module);
    field = simpleSerializers.getClass().getDeclaredField("_interfaceMappings");
    field.setAccessible(true);
    HashMap<ClassKey, JsonSerializer<?>> classMappings = (HashMap) field.get(simpleSerializers);
    assertTrue(classMappings.containsKey(new ClassKey(Page.class)));
}
Also used : Field(java.lang.reflect.Field) HashMap(java.util.HashMap) ClassKey(com.fasterxml.jackson.databind.type.ClassKey) SimpleSerializers(com.fasterxml.jackson.databind.module.SimpleSerializers) JsonSerializer(com.fasterxml.jackson.databind.JsonSerializer) Module(com.fasterxml.jackson.databind.Module) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) Test(org.junit.Test)

Aggregations

ClassKey (com.fasterxml.jackson.databind.type.ClassKey)6 HashMap (java.util.HashMap)2 JsonSerializer (com.fasterxml.jackson.databind.JsonSerializer)1 Module (com.fasterxml.jackson.databind.Module)1 AnnotatedClass (com.fasterxml.jackson.databind.introspect.AnnotatedClass)1 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)1 SimpleSerializers (com.fasterxml.jackson.databind.module.SimpleSerializers)1 Field (java.lang.reflect.Field)1 Map (java.util.Map)1 Test (org.junit.Test)1