@Test public void testBdmModsDefinition() throws Exception { String toJson = "{\"BdmModsWrapper\":{\n" + " \"mods\":{\n" + " \"identifier\":{\n" + " \"value\":\"8232b78c-345b-40ae-9dc0-17bbb101d304\", \n" + " \"type\":\"uuid\"\n" + " }, \n" + " \"version\":\"3.5\", \n" + " \"relatedItem\":{\n" + " \"part\":{\n" + " \"extent\":{\n" + " \"start\":{\n" + " \"value\":\"1\"\n" + " }, \n" + " \"end\":{\n" + " \"value\":\"2\"\n" + " }\n" + " }\n" + " }\n" + " }\n" + " }, \n" + " \"reviewed\":true\n" + "}}"; ObjectMapper om = new JacksonProvider().getContext(BdmModsWrapper.class); om.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); BdmModsWrapper result = om.readValue(toJson, BdmModsWrapper.class); assertNotNull(result); ModsDefinition resultMods = result.getMods(); assertNotNull(resultMods); String toXml = ModsUtils.toXml(resultMods, true); IdentifierDefinition resultPid = resultMods.getIdentifier().get(0); assertEquals(toXml, "uuid", resultPid.getType()); assertEquals(toXml, "8232b78c-345b-40ae-9dc0-17bbb101d304", resultPid.getValue()); assertFalse(toXml, resultMods.getRelatedItem().isEmpty()); assertEquals(toXml, "1", resultMods.getRelatedItem().get(0).getPart().get(0).getExtent().get(0).getStart().getValue()); }
@Override public ObjectMapper getContext(Class<?> type) { return mapper; }
JacksonProvider implements ContextResolver<ObjectMapper> { @Override public ObjectMapper getContext(Class<?> type) { return mapper; } }
JacksonProvider implements ContextResolver<ObjectMapper> { @Override public ObjectMapper getContext(Class<?> type) { return mapper; } JacksonProvider(); }
JacksonProvider implements ContextResolver<ObjectMapper> { @Override public ObjectMapper getContext(Class<?> type) { return mapper; } JacksonProvider(); @Override ObjectMapper getContext(Class<?> type); }
JacksonProvider implements ContextResolver<ObjectMapper> { @Override public ObjectMapper getContext(Class<?> type) { return mapper; } JacksonProvider(); @Override ObjectMapper getContext(Class<?> type);  }