WikibaseDataEditor { public MediaInfoDocument editMediaInfoDocument( MediaInfoDocument mediaInfoDocument, boolean clear, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException { String data = JsonSerializer.getJsonString(mediaInfoDocument); return (MediaInfoDocument) this.wbEditingAction.wbEditEntity( mediaInfoDocument.getEntityId().getId(), null, null, null, data, clear, this.editAsBot, mediaInfoDocument.getRevisionId(), summary, tags); } WikibaseDataEditor(ApiConnection connection, String siteUri);  WikibaseDataEditor(ApiConnection connection, String siteUri, GuidGenerator generator); boolean editAsBot(); void setEditAsBot(boolean editAsBot); int getMaxLag(); void setMaxLag(int maxLag); int getMaxLagMaxRetries(); void setMaxLagMaxRetries(int retries); int getMaxLagFirstWaitTime(); void setMaxLagFirstWaitTime(int time); double getMaxLagBackOffFactor(); void setMaxLagBackOffFactor(double value); int getAverageTimePerEdit(); void setAverageTimePerEdit(int milliseconds); int getRemainingEdits(); void setRemainingEdits(int remainingEdits); void disableEditing(); ItemDocument createItemDocument(ItemDocument itemDocument,
			String summary, List<String> tags); PropertyDocument createPropertyDocument(
			PropertyDocument propertyDocument, String summary, List<String> tags); ItemDocument editItemDocument(ItemDocument itemDocument,
			boolean clear, String summary, List<String> tags); PropertyDocument editPropertyDocument(
			PropertyDocument propertyDocument, boolean clear, String summary,
			List<String> tags); MediaInfoDocument editMediaInfoDocument(
			MediaInfoDocument mediaInfoDocument, boolean clear, String summary,
			List<String> tags); ItemDocument updateStatements(ItemIdValue itemIdValue,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); ItemDocument updateTermsStatements(ItemIdValue itemIdValue,
			List<MonolingualTextValue> addLabels,
			List<MonolingualTextValue> addDescriptions,
			List<MonolingualTextValue> addAliases,
			List<MonolingualTextValue> deleteAliases,
			List<Statement> addStatements,
			List<Statement> deleteStatements,
			String summary,
			List<String> tags); PropertyDocument updateStatements(PropertyIdValue propertyIdValue,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); @SuppressWarnings("unchecked") T updateStatements(T currentDocument,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); @SuppressWarnings("unchecked") T updateTermsStatements(T currentDocument,
			List<MonolingualTextValue> addLabels,
			List<MonolingualTextValue> addDescriptions,
			List<MonolingualTextValue> addAliases,
			List<MonolingualTextValue> deleteAliases,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); void nullEdit(ItemIdValue itemId); void nullEdit(PropertyIdValue propertyId); @SuppressWarnings("unchecked") T nullEdit(T currentDocument);  }
@Test public void testEditMediaInfo() throws IOException, MediaWikiApiErrorException { WikibaseDataEditor wde = new WikibaseDataEditor(this.con, Datamodel.SITE_WIKIMEDIA_COMMONS); MediaInfoIdValue id = Datamodel.makeWikimediaCommonsMediaInfoIdValue("M12223"); MediaInfoDocument mediaInfoDocument = Datamodel.makeMediaInfoDocument(id) .withLabel(Datamodel.makeMonolingualTextValue("test", "en")); MediaInfoDocument expectedResultDocument = Datamodel.makeMediaInfoDocument(id) .withLabel(Datamodel.makeMonolingualTextValue("test", "en")) .withRevisionId(1235); String resultData = JsonSerializer .getJsonString(expectedResultDocument); String expectedResult = "{\"entity\":" + resultData + ",\"success\":1}"; Map<String, String> params = new HashMap<>(); params.put("action", "wbeditentity"); params.put("id", "M12223"); params.put("summary", "My summary"); params.put("tags", "tag1|tag2"); params.put("token", "42307b93c79b0cb558d2dfb4c3c92e0955e06041+\\"); params.put("format", "json"); params.put("maxlag", "5"); String data = JsonSerializer.getJsonString(mediaInfoDocument); params.put("data", data); con.setWebResource(params, expectedResult); MediaInfoDocument result = wde.editMediaInfoDocument(mediaInfoDocument, false, "My summary", Arrays.asList("tag1", "tag2")); assertEquals(expectedResultDocument, result); }