@Test
public void testEditItem() throws IOException, MediaWikiApiErrorException {

	WikibaseDataEditor wde = new WikibaseDataEditor(this.con,
			Datamodel.SITE_WIKIDATA);
	ItemIdValue id = Datamodel.makeWikidataItemIdValue("Q1234");
	ItemDocument itemDocument = ItemDocumentBuilder.forItemId(id)
			.withRevisionId(1234).build();
	ItemDocument expectedResultDocument = ItemDocumentBuilder.forItemId(id)
			.withRevisionId(1235).build();
	String resultData = JsonSerializer
			.getJsonString(expectedResultDocument);
	String expectedResult = "{\"entity\":" + resultData + ",\"success\":1}";
	Map<String, String> params = new HashMap<>();
	params.put("action", "wbeditentity");
	params.put("id", "Q1234");
	params.put("summary", "My summary");
	params.put("tags", "tag1|tag2");
	params.put("token", "42307b93c79b0cb558d2dfb4c3c92e0955e06041+\\");
	params.put("format", "json");
	params.put("baserevid", "1234");
	params.put("maxlag", "5");
	String data = JsonSerializer.getJsonString(itemDocument);
	params.put("data", data);
	con.setWebResource(params, expectedResult);
	ItemDocument result = wde.editItemDocument(itemDocument, false,
			"My summary", Arrays.asList("tag1", "tag2"));
	assertEquals(expectedResultDocument, result);
}