### Question:
AtcParser { public List<AtcDescription> parse(InputStream is) throws IOException { String inputLine; List<AtcDescription> finalList = new ArrayList<AtcDescription>(); BufferedReader readCode = new BufferedReader(new InputStreamReader(is)); while ((inputLine = readCode.readLine()) != null) { if(!findDrugDetails(inputLine).isEmpty()){ finalList.addAll(findDrugDetails(inputLine)); } } return finalList; }  List<AtcDescription> findDrugDetails(String inputLine); List<AtcDescription> parse(InputStream is); AtcDescription getAtcCode(String drugName); List<AtcDescription> getAtcDetails(String atcCode);  }### Answer:
@Test public void testDrugAllDetailsParse() throws IOException { AtcParser parser = new AtcParser(); List<AtcDescription> finalList = parser.parse(d_codeStream); assertEquals(6, finalList.size()); assertEquals("N", finalList.get(0).getCode()); assertEquals("NERVOUS SYSTEM", finalList.get(0).getDescription()); assertEquals("N07", finalList.get(1).getCode()); assertEquals("OTHER NERVOUS SYSTEM DRUGS", finalList.get(1).getDescription()); assertEquals("N07B", finalList.get(2).getCode()); assertEquals("DRUGS USED IN ADDICTIVE DISORDERS", finalList.get(2).getDescription()); assertEquals("N07BA", finalList.get(3).getCode()); assertEquals("Drugs used in nicotine dependence", finalList.get(3).getDescription()); assertEquals("N07BA01", finalList.get(4).getCode()); assertEquals("nicotine", finalList.get(4).getDescription()); assertEquals("N07BA03", finalList.get(5).getCode()); assertEquals("varenicline", finalList.get(5).getDescription()); }
@Test public void testDrugAllDetailsParseFromUrl() throws IOException { d_urlStream = new URL("http: AtcParser parser = new AtcParser(); List<AtcDescription> finalList = parser.parse(d_urlStream); assertEquals(6, finalList.size()); assertEquals("N", finalList.get(0).getCode()); assertEquals("NERVOUS SYSTEM", finalList.get(0).getDescription()); assertEquals("N07", finalList.get(1).getCode()); assertEquals("OTHER NERVOUS SYSTEM DRUGS", finalList.get(1).getDescription()); assertEquals("N07B", finalList.get(2).getCode()); assertEquals("DRUGS USED IN ADDICTIVE DISORDERS", finalList.get(2).getDescription()); assertEquals("N07BA", finalList.get(3).getCode()); assertEquals("Drugs used in nicotine dependence", finalList.get(3).getDescription()); assertEquals("N07BA01", finalList.get(4).getCode()); assertEquals("nicotine", finalList.get(4).getDescription()); assertEquals("N07BA03", finalList.get(5).getCode()); assertEquals("varenicline", finalList.get(5).getDescription()); }