PubMedSearch { public Collection<String> searchAndRetrieveIdsByHTTP( Collection<String> searchTerms ) throws IOException, SAXException, ParserConfigurationException { StringBuilder builder = new StringBuilder(); for ( String word : searchTerms ) { builder.append( word ); builder.append( " " ); } return searchAndRetrieveIdsByHTTP( builder.toString() ); } PubMedSearch(); Collection<BibliographicReference> searchAndRetrieveByHTTP( Collection<String> searchTerms ); Collection<BibliographicReference> searchAndRetrieveIdByHTTP( Collection<String> searchTerms ); Collection<String> searchAndRetrieveIdsByHTTP( Collection<String> searchTerms ); Collection<String> searchAndRetrieveIdsByHTTP( String searchQuery );  }
@Test public void testSearchAndRetrievIdsByHTTP() throws Exception { try { PubMedSearch pms = new PubMedSearch(); Collection<String> searchTerms = new HashSet<>(); searchTerms.add( "brain" ); searchTerms.add( "hippocampus" ); searchTerms.add( "habenula" ); searchTerms.add( "glucose" ); Collection<String> actualResult = pms.searchAndRetrieveIdsByHTTP( searchTerms ); assertTrue( "Expect at least 5 results, got " + actualResult.size(), actualResult.size() >= 5 ); } catch ( java.net.UnknownHostException e ) { PubMedSearchTest.log.warn( "Test skipped due to unknown host exception" ); } catch ( java.io.IOException e ) { this.checkCause( e ); } }