1- /*
2- * BioJava development code
3- *
4- * This code may be freely distributed and modified under the
5- * terms of the GNU Lesser General Public Licence. This should
6- * be distributed with the code. If you do not have a copy,
7- * see:
8- *
9- * http://www.gnu.org/copyleft/lesser.html
10- *
11- * Copyright for this code is held jointly by the individual
12- * authors. These should be listed in @author doc comments.
13- *
14- * For more information on the BioJava project and its aims,
15- * or to join the biojava-l mailing list, visit the home page
16- * at:
17- *
18- * http://www.biojava.org/
19- *
20- */
1+ /*
2+ * BioJava development code
3+ *
4+ * This code may be freely distributed and modified under the
5+ * terms of the GNU Lesser General Public Licence. This should
6+ * be distributed with the code. If you do not have a copy,
7+ * see:
8+ *
9+ * http://www.gnu.org/copyleft/lesser.html
10+ *
11+ * Copyright for this code is held jointly by the individual
12+ * authors. These should be listed in @author doc comments.
13+ *
14+ * For more information on the BioJava project and its aims,
15+ * or to join the biojava-l mailing list, visit the home page
16+ * at:
17+ *
18+ * http://www.biojava.org/
19+ *
20+ */
2121package org .biojava .nbio .core .search .io .blast ;
2222
2323import java .io .File ;
@@ -86,6 +86,17 @@ public void testSetFile() {
8686 instance .setFile (f );
8787 }
8888
89+
90+ protected File getFileForResource (String resource ){
91+ URL resourceURL = this .getClass ().getResource (resource );
92+ String filepath = resourceURL .getFile ();
93+ filepath = filepath .replaceAll ("%20" ," " );
94+
95+ File file = new File (filepath );
96+
97+ return file ;
98+ }
99+
89100 /**
90101 * Test of createObjects method, of class BlastTabularParser.
91102 */
@@ -97,8 +108,7 @@ public void testCreateObjects() throws Exception {
97108 Hsp expHsp1hit1res1 ;
98109
99110 String resource = "/org/biojava/nbio/core/search/io/blast/small-blastreport.blasttxt" ;
100- URL resourceURL = getClass ().getResource (resource );
101- File file = new File (resourceURL .getFile ());
111+ File file = getFileForResource (resource );
102112
103113 BlastTabularParser instance = new BlastTabularParser ();
104114 instance .setFile (file );
@@ -163,8 +173,8 @@ public void testCreateObjects() throws Exception {
163173
164174
165175 String resource2 = "/org/biojava/nbio/core/search/io/blast/testBlastTabularReport.txt" ;
166- URL resourceURL2 = getClass (). getResource ( resource2 );
167- File file2 = new File ( resourceURL2 . getFile () );
176+
177+ File file2 = getFileForResource ( resource2 );
168178
169179 BlastTabularParser instance2 = new BlastTabularParser ();
170180 instance2 .setFile (file2 );
0 commit comments