@Test public void testUnmarshalJSON() { String rawMsg = read("/HttpClientErrorException.json"); assertThat(ErrorMap.from(rawMsg)).isEqualTo("Could not authenticate you."); }
public static String from(String rawMsg) { if (rawMsg.matches("^\\s*\\<.*")) { return parseWith(rawMsg, new XmlMapper()); } if (rawMsg.matches("^\\s*\\{.*")) { return parseWith(rawMsg, new ObjectMapper()); } return rawMsg; }
ErrorMap { public static String from(String rawMsg) { if (rawMsg.matches("^\\s*\\<.*")) { return parseWith(rawMsg, new XmlMapper()); } if (rawMsg.matches("^\\s*\\{.*")) { return parseWith(rawMsg, new ObjectMapper()); } return rawMsg; } }
ErrorMap { public static String from(String rawMsg) { if (rawMsg.matches("^\\s*\\<.*")) { return parseWith(rawMsg, new XmlMapper()); } if (rawMsg.matches("^\\s*\\{.*")) { return parseWith(rawMsg, new ObjectMapper()); } return rawMsg; } private  ErrorMap(); }
ErrorMap { public static String from(String rawMsg) { if (rawMsg.matches("^\\s*\\<.*")) { return parseWith(rawMsg, new XmlMapper()); } if (rawMsg.matches("^\\s*\\{.*")) { return parseWith(rawMsg, new ObjectMapper()); } return rawMsg; } private  ErrorMap(); static String from(String rawMsg); }
ErrorMap { public static String from(String rawMsg) { if (rawMsg.matches("^\\s*\\<.*")) { return parseWith(rawMsg, new XmlMapper()); } if (rawMsg.matches("^\\s*\\{.*")) { return parseWith(rawMsg, new ObjectMapper()); } return rawMsg; } private  ErrorMap(); static String from(String rawMsg);  }