AddonUtils { public static boolean isListWithKeyAndDisplayValues(AddonFieldDefinition field) { return isListWithKeyAndDisplayValues(field.getProperties()); }  static Map<String, AddonGroup> asMap(List<AddonGroup> addons); static Optional<AddonGroupDefinition> findAddonGroupDefinition(String name,
            Map<String, AddonGroupDefinition>... groupDefinitions); static boolean isListWithKeyAndDisplayValues(AddonFieldDefinition field); static boolean isListWithKeyAndDisplayValues(Map<String, Object> properties); static List<Map<String, Object>> getListValues(AddonFieldDefinition fieldDefinition); static Object emptyToNull(Object value);  }
@Test public void testIsListWithKeyAndDisplayValuesWhenNull() { Map<String, Object> properties = null; Assert.assertFalse(AddonUtils.isListWithKeyAndDisplayValues(properties)); }
@Test public void testIsListWithKeyAndDisplayValuesWhenEmpty() { Map<String, Object> properties = new HashMap<String, Object>(); Assert.assertFalse(AddonUtils.isListWithKeyAndDisplayValues(properties)); }
@Test public void testIsListWithKeyAndDisplayValuesWhenListOfStrings() { Map<String, Object> properties = new HashMap<String, Object>(); properties.put("listValues", Arrays.asList("toto", "tata")); Assert.assertFalse(AddonUtils.isListWithKeyAndDisplayValues(properties)); }
@Test public void testIsListWithKeyAndDisplayValuesIsKeyValueMap() { Map<String, Object> properties = new HashMap<String, Object>(); properties.put("listValues", Arrays.asList( new HashMap() { { put("key", "toto"); put("name", "Toto"); } }, new HashMap() { { put("key", "tata"); put("name", "Tata"); } } )); Assert.assertTrue(AddonUtils.isListWithKeyAndDisplayValues(properties)); }