@Test
// Here we just check if the correct number of objects (edges, products, productItems) are passed from the
// background-task to the DownloadListeners.
// The details of the objects are left to the OsmParserTest.
public void testDoInBackground() throws IOException {

    OsmParser parser = mock(OsmParser.class);
    DownloadMapDataTask taskToTest = new DownloadMapDataTask(wayManager, mapServerClient, "test", parser);
    Map<String, Collection> results = new HashMap<String, Collection>();
    when(parser.getResults()).thenReturn(results);
    Map<String, Collection> result = taskToTest.doInBackground(null);
    // This will normally be called by the android system, because that's how AsyncTasks work:
    taskToTest.onPostExecute(result);
    // All DownloadTasks will receive all of the data. It is up to each of them what parts to use. Here we use the
    // wayManager only to test for all things.
    verify(wayManager).onDownloadFinished(eq(taskToTest), eq(true), eq(results));
    verify(parser, times(1)).parse(any(InputStream.class));
    /*
    Collection<Edge> edges = (Collection<Edge>)edgesCaptor.getValue().get(DownloadMapDataTask.EDGES);
    assertEquals(7, edges.size());
    Collection<Product> products = (Collection<Product>)edgesCaptor.getValue().get(DownloadMapDataTask.PRODUCTS);
    assertEquals(3, products.size());
    Collection<ProductItem> productItems = (Collection<ProductItem>)edgesCaptor.getValue().get(DownloadMapDataTask.PRODUCTITEMS);
    assertEquals(4, productItems.size());
    */
}