### Question:
MapUtil { public static <K, V> List<Map<String, Object>> mapConvertToList(Map<K, V> map) { return mapConvertToList(map, null); }  static MapPlain<K, V> build(); static MapPlain<K, V> build(int cap); static Map<String, Object> toMap(Object o, Map<String, String> map, String... ignoreProperties); static Map<String, Object> toMap(Object o, String... ignoreProperties); static void toObject(Map<String, Object> source, Object target, String... ignoreProperties); static List<Map<String, Object>> mapConvertToList(Map<K, V> map); static List<Map<String, Object>> mapConvertToList(Map<K, V> map, Object defaultValue);  }### Answer:
@Test public void testEmptyMapConvertToList() { Map<String, Object> map = new HashMap<>(); List<Map<String, Object>> list = MapUtil.mapConvertToList(map); assertEquals(list.size(), 0); }
@Test public void testMapConvertToList() { Map<String, Object> map = new HashMap<>(); map.put("name", "name"); map.put("age", 25); List<Map<String, Object>> list = MapUtil.mapConvertToList(map); assertEquals(list.size(), 2); assertEquals(list.get(0).get("value"), "name"); assertEquals(list.get(1).get("value"), "age"); }
@Test public void testMapConvertToListDefaultValue() { Map<String, Object> map = new HashMap<>(); map.put("name", "name"); map.put("age", 25); List<Map<String, Object>> list = MapUtil.mapConvertToList(map, "age"); assertTrue((Boolean) list.get(1).get("selected")); }