WbGetEntitiesAction { public Map<String, EntityDocument> wbGetEntities( WbGetEntitiesActionData properties) throws MediaWikiApiErrorException, IOException { return wbGetEntities(properties.ids, properties.sites, properties.titles, properties.props, properties.languages, properties.sitefilter); } WbGetEntitiesAction(ApiConnection connection, String siteIri); Map<String, EntityDocument> wbGetEntities(
			WbGetEntitiesActionData properties); Map<String, EntityDocument> wbGetEntities(String ids, String sites,
			String titles, String props, String languages, String sitefilter);  }
@Test public void testWbGetEntitiesWithProps() throws MediaWikiApiErrorException, IOException { WbGetEntitiesActionData properties = new WbGetEntitiesActionData(); properties.ids = "Q6|Q42|P31"; properties.props = "datatype|labels|aliases|descriptions|claims|sitelinks"; Map<String, EntityDocument> result1 = action.wbGetEntities(properties); Map<String, EntityDocument> result2 = action.wbGetEntities( properties.ids, null, null, properties.props, null, null); assertTrue(result1.containsKey("Q42")); assertEquals(result1, result2); }
@Test public void testWbGetEntitiesNoProps() throws MediaWikiApiErrorException, IOException { WbGetEntitiesActionData properties = new WbGetEntitiesActionData(); properties.ids = "Q6|Q42|P31"; Map<String, EntityDocument> result1 = action.wbGetEntities(properties); Map<String, EntityDocument> result2 = action.wbGetEntities( properties.ids, null, null, properties.props, null, null); assertTrue(result1.containsKey("Q42")); assertEquals(result1, result2); }
@Test public void testWbGetEntitiesRedirected() throws MediaWikiApiErrorException, IOException { WbGetEntitiesActionData properties = new WbGetEntitiesActionData(); properties.ids = "Q32063953"; Map<String, EntityDocument> result = action.wbGetEntities(properties); assertTrue(result.containsKey("Q32063953")); }
@Test public void testWbGetEntitiesPropsFilters() throws MediaWikiApiErrorException, IOException { WbGetEntitiesActionData properties = new WbGetEntitiesActionData(); properties.ids = "Q6|Q42|P31"; properties.props = "datatype|labels|aliases|descriptions|claims|sitelinks"; properties.languages = "en"; properties.sitefilter = "enwiki"; Map<String, EntityDocument> result1 = action.wbGetEntities(properties); Map<String, EntityDocument> result2 = action.wbGetEntities( properties.ids, null, null, properties.props, null, null); assertTrue(result1.containsKey("Q42")); assertEquals(result1, result2); }
@Test(expected = IOException.class) public void testWbGetEntitiesIoError() throws MediaWikiApiErrorException, IOException { WbGetEntitiesActionData properties = new WbGetEntitiesActionData(); properties.ids = "Q6|Q42|notmocked"; action.wbGetEntities(properties); }
@Test(expected = IllegalArgumentException.class) public void testIdsAndTitles() throws MediaWikiApiErrorException, IOException { action.wbGetEntities("Q42", null, "Tim Berners Lee", null, null, null); }
@Test(expected = IllegalArgumentException.class) public void testIdsAndSites() throws MediaWikiApiErrorException, IOException { action.wbGetEntities("Q42", "enwiki", null, null, null, null); }
@Test(expected = IllegalArgumentException.class) public void testTitlesNoSites() throws MediaWikiApiErrorException, IOException { action.wbGetEntities(null, null, "Tim Berners Lee", null, null, null); }
@Test(expected = IllegalArgumentException.class) public void testNoTitlesOrIds() throws MediaWikiApiErrorException, IOException { action.wbGetEntities(null, "enwiki", null, null, null, null); }