### Question:
EditForm extends XWikiForm { public Map<String, SortedMap<Integer, Map<String, String[]>>> getUpdateOrCreateMap() { return updateOrCreateMap; }  @Override void readRequest(); void setTags(String[] parameter); String getTags(); String getContent(); void setContent(String content); String getWeb(); void setWeb(String web); String getName(); void setName(String name); String getLanguage(); void setLanguage(String language); int getObjectNumbers(String prefix); Map<String, String[]> getObject(String prefix); String getParent(); void setParent(String parent); String getCreator(); void setCreator(String creator); String getTemplate(); void setTemplate(String template); String getDefaultTemplate(); void setDefaultTemplate(String defaultTemplate); String getDefaultLanguage(); void setDefaultLanguage(String defaultLanguage); String getTitle(); void setTitle(String title); String getComment(); void setComment(String comment); boolean isMinorEdit(); void setMinorEdit(boolean isMinorEdit); boolean isLockForce(); void setLockForce(boolean lockForce); String getSyntaxId(); void setSyntaxId(String syntaxId); String getHidden(); void setHidden(String hidden); ObjectPolicyType getObjectPolicy(); Map<String, List<Integer>> getObjectsToRemove(); Map<String, List<Integer>> getObjectsToAdd(); Map<String, SortedMap<Integer, Map<String, String[]>>> getUpdateOrCreateMap();  }### Answer:
@Test public void getUpdateOrCreateMap() { when(this.httpRequest.getParameter("objectPolicy")).thenReturn(""); Map<String, String[]> parameterMap = new HashMap<>(); String[] paramValue1 = { "value1", "value2" }; String[] paramValue2 = { "value1" }; String[] paramValue3 = { "value2" }; parameterMap.put("someParam", paramValue2); parameterMap.put("XWiki.XWikiRights_42_baz", paramValue1); parameterMap.put("XWiki.XWikiRights_0_foo", paramValue1); parameterMap.put("XWiki.XWikiRights_1_foo", paramValue2); parameterMap.put("XWiki.XWikiRights_1_bar", paramValue3); parameterMap.put("EditIT.saveActionValidatesWhenXValidateIsPresent.WebHome_0_prop", paramValue1); parameterMap.put("foobar_18_buz", paramValue1); parameterMap.put("foo_48bar_buz", paramValue1); parameterMap.put("MyClass_18_param.WebHome_0_Something_18_name", paramValue1); when(this.httpRequest.getParameterMap()).thenReturn(parameterMap); this.editForm.readRequest(); assertEquals(Collections.emptyMap(), this.editForm.getUpdateOrCreateMap()); when(this.httpRequest.getParameter("objectPolicy")).thenReturn("updateOrCreate"); this.editForm.readRequest(); Map<String, SortedMap<Integer, Map<String, String[]>>> expectedMap = new HashMap<>(); TreeMap<Integer, Map<String, String[]>> treeMap = new TreeMap<>(); treeMap.put(0, Collections.singletonMap("foo", paramValue1)); treeMap.put(42, Collections.singletonMap("baz", paramValue1)); Map<String, String[]> parametersValues = new HashMap<>(); parametersValues.put("foo", paramValue2); parametersValues.put("bar", paramValue3); treeMap.put(1, parametersValues); expectedMap.put("XWiki.XWikiRights", treeMap); treeMap = new TreeMap<>(); treeMap.put(0, Collections.singletonMap("Something_18_name", paramValue1)); expectedMap.put("MyClass_18_param.WebHome", treeMap); treeMap = new TreeMap<>(); treeMap.put(0, Collections.singletonMap("prop", paramValue1)); expectedMap.put("EditIT.saveActionValidatesWhenXValidateIsPresent.WebHome", treeMap); assertEquals(expectedMap, this.editForm.getUpdateOrCreateMap()); }