DownloadFingerprintsTask extends DownloadTask<Void, Void, String> { protected InputStream getInputStream() throws UnsupportedEncodingException, FileNotFoundException { final String json = downloadFingerprints(); final InputStream stream = new ByteArrayInputStream(json.getBytes("UTF-8")); return stream; } DownloadFingerprintsTask(FingerprintManager fingerprintManager,
                                    Activity activity,
                                    MapServerClient mapServerClient,
                                    String mapName);  DownloadFingerprintsTask(MultiLevelFingerprintManager fingerprintManager,
                                    Activity activity,
                                    MapServerClient mapServerClient,
                                    String mapName,
                                    DownloadListener<String> listener,
                                    int level);  static final String TAG; }
@Test public void testGetInputStream() throws IOException { DownloadFingerprintsTask taskToTest = new DownloadFingerprintsTask(fingerprintManager, activity, mapServerClient, "test"); InputStream result = taskToTest.getInputStream(); StringWriter stringWriter = new StringWriter(); IOUtils.copy(result, stringWriter, "UTF-8"); String resultString = stringWriter.toString(); assertEquals(json, resultString); }