### Question:
SearchUtils { public static Integer getIntegerFromJsonMap(Map<String, Object> map, String key) throws NumberFormatException { if (map == null) return null; Object o = map.get(key); if (o == null) return null; if (o instanceof Integer) return (Integer) o; else if (o instanceof Number) return ((Number) o).intValue(); else if (o instanceof String) return Integer.valueOf((String) o); else throw new NumberFormatException(); }  static Properties loadProperties(String path); static String trimToNull(String value); static List<String> safeList(List<String> values); static boolean isBlank(String value); static boolean isBlank(Object value); static String convertJsonMapToString(Map<String, Object> jsonMapValue); static DateFormat getISODateFormat(); static Date dateFromISOString(String string, boolean silent); static boolean isDateAfter(Object date, int thresholdInMinutes); static Map<String, Object> convertToJsonMap(String jsonData); static Integer getIntegerFromJsonMap(Map<String, Object> map, String key); @SuppressWarnings("unchecked") static List<String> getListOfStringsFromJsonMap(Map<String, Object> map, String key); static void mergeJsonMaps(Map<String, Object> source, Map<String, Object> target); static Map<String, Object> collapseURLParams(MultivaluedMap<String, String> params); static boolean isMysqlDialect(String databaseProductName);  }### Answer:
@Test public void getIntegerFromJsonMap() { Assert.assertNull(SearchUtils.getIntegerFromJsonMap(null, KEY)); Map<String, Object> m = new HashMap<>(); Assert.assertNull(SearchUtils.getIntegerFromJsonMap(m, KEY)); m.put(KEY, new Integer(10)); Assert.assertEquals(new Integer(10), SearchUtils.getIntegerFromJsonMap(m, KEY)); m.put(KEY, new Long(12)); Assert.assertEquals(new Integer(12), SearchUtils.getIntegerFromJsonMap(m, KEY)); m.put(KEY, new Float(15)); Assert.assertEquals(new Integer(15), SearchUtils.getIntegerFromJsonMap(m, KEY)); m.put(KEY, "20"); Assert.assertEquals(new Integer(20), SearchUtils.getIntegerFromJsonMap(m, KEY)); m.put(KEY, "-20"); Assert.assertEquals(new Integer(-20), SearchUtils.getIntegerFromJsonMap(m, KEY)); m.put(KEY, "a"); try { SearchUtils.getIntegerFromJsonMap(m, KEY); Assert.fail("NumberFormatException must be thrown"); } catch (NumberFormatException e) { } m.put(KEY, new Object()); try { SearchUtils.getIntegerFromJsonMap(m, KEY); Assert.fail("NumberFormatException must be thrown"); } catch (NumberFormatException e) { } }