CollectionPresenter implements CollectionView.Presenter { protected void populateList(JSONValue jsonValue) { final JSONArray array = jsonValue.isArray(); for (int i = 0; i < array.size(); i++) { final JSONObject jsonObject = array.get(i).isObject(); final Map<String, String> propertiesValues = getSimplePropertiesMap(jsonObject); final Map<String, Map<String, String>> expandablePropertiesValues = getExpandablePropertiesValues(jsonObject); addListItem(propertiesValues, expandablePropertiesValues); } }  @Override void initListStructure(String key, Map<String, String> simplePropertiesMap, Map<String, Map<String, String>> expandablePropertiesMap, CollectionView collectionView); @Override void initMapStructure(String key, Map<String, String> keyPropertyMap, Map<String, String> valuePropertyMap, CollectionView collectionView); @Override void setValue(String jsonString); @Override void showEditingBox(); @Override void onToggleRowExpansion(boolean isShown); @Override void updateRowExpansionStatus(boolean isShown); @Override void addListItem(Map<String, String> simplePropertiesValues, Map<String, Map<String, String>> expandablePropertiesValues); @Override void addMapItem(Map<String, String> keyPropertiesValues, Map<String, String> valuePropertiesValues); @Override void save(); @Override void remove(); @Override void toggleEditingStatus(boolean editingStatus);  }
@Test public void populateList() { collectionEditorPresenterSpy.populateList(jsonValueMock); for (int i = 0; i < JSON_ARRAY_SIZE; i++) { verify(jsonArrayMock, times(1)).get(eq(i)); } verify(collectionEditorPresenterSpy, times(JSON_ARRAY_SIZE * 3)).getSimplePropertiesMap(any()); verify(collectionEditorPresenterSpy, times(JSON_ARRAY_SIZE)).getExpandablePropertiesValues(any()); verify(collectionEditorPresenterSpy, times(JSON_ARRAY_SIZE)).addListItem(anyMap(), anyMap()); }