ContentFragmentUtils { public static String[] getItemsOrder(Map<String, ?> itemsMap) { if (itemsMap == null || itemsMap.isEmpty()) { return ArrayUtils.EMPTY_STRING_ARRAY; } return itemsMap.keySet().toArray(ArrayUtils.EMPTY_STRING_ARRAY); } private  ContentFragmentUtils(); static String getType(ContentFragment contentFragment); static Iterator<ContentElement> filterElements(final ContentFragment contentFragment,
                                                          final String[] elementNames); static String getEditorJSON(final ContentFragment contentFragment,
                                       final String variationName,
                                       final String[] elementNames); static String getGridResourceType(Resource fragmentResource); static String[] getItemsOrder(Map<String, ?> itemsMap); static Map<String, ComponentExporter> getComponentExporters(Iterator<Resource> resourceIterator,
                                                                       ModelFactory modelFactory,
                                                                       SlingHttpServletRequest slingHttpServletRequest);  }
@Test public void getItemsOrderOfEmptyMap() { Map<String, Object> items = new HashMap<>(); String[] itemsOrder = ContentFragmentUtils.getItemsOrder(items); Assertions.assertArrayEquals(itemsOrder, ArrayUtils.EMPTY_STRING_ARRAY); }
@Test public void getItemsOrderOfMap() { Map<String, Object> items = new LinkedHashMap<>(); items.put("first", "3"); items.put("second", 1); items.put("third", 2L); String[] itemsOrder = ContentFragmentUtils.getItemsOrder(items); Assertions.assertArrayEquals(itemsOrder, new String[]{"first", "second", "third"}); }