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

	// Test what happens if the API returns JSON without an actual entity
	// document and without any respective key
	WikibaseDataEditor wde = new WikibaseDataEditor(this.con,
			Datamodel.SITE_WIKIDATA);
	ItemDocument itemDocument = ItemDocumentBuilder.forItemId(
			ItemIdValue.NULL).build();
	ItemDocument expectedResultDocument = ItemDocumentBuilder
			.forItemId(Datamodel.makeWikidataItemIdValue("Q1234"))
			.withRevisionId(1234).build();
	String expectedResult = "{\"entity\":"
			+ "{\"type\":\"item\",\"aliases\":[],\"labels\":[],\"descriptions\":[],\"lastrevid\":1234,\"sitelinks\":[],\"id\":\"Q1234\",\"claims\":[]}"
			+ ",\"success\":1}";
	Map<String, String> params = new HashMap<>();
	params.put("action", "wbeditentity");
	params.put("summary", "My summary");
	params.put("new", "item");
	params.put("token", "42307b93c79b0cb558d2dfb4c3c92e0955e06041+\\");
	params.put("format", "json");
	params.put("maxlag", "5");
	String data = JsonSerializer.getJsonString(itemDocument);
	params.put("data", data);
	con.setWebResource(params, expectedResult);
	ItemDocument result = wde
			.createItemDocument(itemDocument, "My summary", null);
	assertEquals(expectedResultDocument, result);
}