diff --git a/src/biotree/TestBioTree.java b/src/biotree/TestBioTree.java index 67005ca5968e23db0f0a7d051e68d02a0f93647d..3257bf20cc3d61811a9b8bfe225425fa9af5ef14 100644 --- a/src/biotree/TestBioTree.java +++ b/src/biotree/TestBioTree.java @@ -2,13 +2,15 @@ package biotree; import static org.junit.Assert.*; +import java.io.IOException; + import org.junit.Before; import org.junit.Test; public class TestBioTree { @Before - public static void main(String[] args) { + public static void main(String[] args) throws IOException { BioTree.init(); BioTree.processRecord(125125); BioTree.processRecord(125125); @@ -29,6 +31,7 @@ public class TestBioTree { //System.out.println(String.format("%-26s %s", nodes.get(i).getName(), nodes.get(i).getTaxonType())); //} BioTree.printTree(); + System.out.println(WormsAPI.nameToID("Hello")); } diff --git a/src/biotree/WormsAPI.java b/src/biotree/WormsAPI.java index 79c0ccab86a9d3657b5a5c3a99c368b60861f834..ac595ae3e0560c2beaf2ce986c4587735683f0b3 100644 --- a/src/biotree/WormsAPI.java +++ b/src/biotree/WormsAPI.java @@ -38,11 +38,11 @@ public class WormsAPI { * @return Aphia (taxon) ID of given scientific name. * @throws IOException */ - public static int nameToID(String scientificName) throws IOException { + public static Integer nameToID(String scientificName) throws IOException { scientificName = repSpaces(scientificName); String resp = makeRequest( String.format("http://marinespecies.org/rest/AphiaIDByName/%s?marine_only=false", scientificName)); - + if (resp.length() == 0) return null; return Integer.parseInt(resp); }