ArgumentServices { public Map getJavaResultFromSpecificUnmarshallerMap(String json, IJsonMarshaller marshaller) throws JsonUnmarshallingException { try { Map<String, Object> result = new HashMap(); JsonReader createReader = Json.createReader(new StringReader(json)); JsonObject readObject = createReader.readObject(); for (Map.Entry<String, JsonValue> entry : readObject.entrySet()) { String key = entry.getKey(); JsonValue jsonValue = entry.getValue(); result.put(key, marshaller.toJava(jsonValue.toString())); } return result; } catch (Throwable t) { throw new JsonUnmarshallingException(t.getMessage()); } }  List<String> getJsonParameters(Object[] parameters, Annotation[][] annotationss); IJsonMarshaller getIJsonMarshallerInstance(Class<? extends IJsonMarshaller> cls); String getJsonResultFromSpecificMarshaller(JsonMarshaller jm, Object result); String getJsonResultFromSpecificMarshallerIterable(Iterable list, IJsonMarshaller marshaller); List getJavaResultFromSpecificUnmarshallerIterable(String json, IJsonMarshaller marshaller); Map getJavaResultFromSpecificUnmarshallerMap(String json, IJsonMarshaller marshaller); void checkType(Object object, Type paramType);  }
@Test public void testGetJavaResultFromSpecificUnmarshallerMap() throws JsonUnmarshallingException { System.out.println("getJavaResultFromSpecificUnmarshallerMap"); LocaleMarshaller lm = new LocaleMarshaller(); String json = "{\"KEY1\":{\"country\":\"FR\",\"language\":\"fr\"},\"KEY2\":{\"country\":\"US\",\"language\":\"en\"}}"; Map result = instance.getJavaResultFromSpecificUnmarshallerMap(json, lm); assertThat(result).hasSize(2); assertThat(result.get("KEY1")).isEqualTo(Locale.FRANCE); assertThat(result.get("KEY2")).isEqualTo(Locale.US); }
@Test(expected = JsonUnmarshallingException.class) public void testGetJavaResultFromSpecificUnmarshallerMapFail() throws JsonUnmarshallingException { System.out.println("getJavaResultFromSpecificUnmarshallerMap"); LocaleMarshaller lm = new LocaleMarshaller(); String json = "{{\"KEY1\"}:{\"country\":\"FR\",\"language\":\"fr\"},{\"KEY2\"}:{\"country\":\"US\",\"language\":\"en\"}}"; instance.getJavaResultFromSpecificUnmarshallerMap(json, lm); }