### Question:
HstoreCountTypeHandler extends BaseTypeHandler<Map<KEY, Integer>> { protected Map<KEY, Integer> sortMap(HashMap<KEY, Integer> map) { return sortMapByValuesDesc(map); }  @Override void setNonNullParameter(PreparedStatement ps, int i, Map<KEY, Integer> parameter, JdbcType jdbcType); @Override Map<KEY, Integer> getNullableResult(ResultSet rs, String columnName); @Override Map<KEY, Integer> getNullableResult(ResultSet rs, int columnIndex); @Override Map<KEY, Integer> getNullableResult(CallableStatement cs, int columnIndex);  }### Answer:
@Test public void testSortMap() throws Exception { HashMap<String, Integer> map = Maps.newHashMap(); map.put("Mimi", 10); map.put("Harry", 100); map.put("Alberto", 2); map.put("Tim", 2); map.put("Svenja", -18); map.put("Fritz", 10974); Map<String, Integer> sorted = HstoreCountTypeHandler.sortMapByValuesDesc(map); Integer last = null; for (Map.Entry<String, Integer> e : sorted.entrySet()) { if (last != null) { assertTrue(last >= e.getValue()); } last = e.getValue(); } }