### Question:
IdDecoder extends AsyncTask<String, Integer, Lyrics> { @Override protected Lyrics doInBackground(String... strings) { String url = strings[0]; String artist; String track; if (url == null) return new Lyrics(ERROR); if (url.contains(" try { String html = getUrlAsString(url); int preceding = html.indexOf("root.App.trackDa") + 19; int following = html.substring(preceding).indexOf(";"); String data = html.substring(preceding, preceding + following); JsonObject jsonData = new JsonParser().parse(data).getAsJsonObject(); artist = jsonData.get("artist_display_name").getAsString(); track = jsonData.get("track_name").getAsString(); } catch (Exception e) { e.printStackTrace(); return new Lyrics(ERROR); } } else if (url.contains(" String id = url.split(".am/t")[1]; url = "https: try { String jsonString = Net.getUrlAsString(url); JsonObject jsonData = new JsonParser().parse(jsonString).getAsJsonObject(); jsonData = jsonData.getAsJsonObject("heading"); artist = jsonData.get("subtitle").getAsString(); track = jsonData.get("title").getAsString(); } catch (Exception e) { e.printStackTrace(); return new Lyrics(ERROR); } } else if (url.contains(" String docID = url.substring(url.indexOf("&tid=") + 5); try { Document doc = Jsoup.connect(url).get(); Element playCell = doc.getElementsByAttributeValue("data-track-docid", docID) .get(0); artist = doc.getElementsByClass("primary").text(); track = playCell.parent().parent().child(1).getElementsByClass("title").text(); } catch (Exception e) { e.printStackTrace(); return new Lyrics(ERROR); } } else return new Lyrics(ERROR); Lyrics res = new Lyrics(Lyrics.SEARCH_ITEM); res.setArtist(artist); res.setTitle(track); return res; } IdDecoder(Context context, LyricsViewFragment lyricsFragment);   }### Answer:
@Test public void testSoundHound() { Lyrics result = idDecoder.doInBackground("http: assertNotNull(result); assertEquals("Tycho", result.getArtist()); assertEquals("Melanine", result.getTitle()); }
@Test public void testShazam() { Lyrics result = idDecoder.doInBackground("http: assertNotNull(result); assertEquals(result.getArtist(), "Tycho"); assertEquals(result.getTitle(), "A Walk"); }
@Test public void testGPlay() { Lyrics result = idDecoder.doInBackground("https: assertNotNull(result); assertEquals(result.getArtist(), "Tycho"); assertEquals(result.getTitle(), "A Walk"); }