Skip to content

Commit 9ecbbe0

Browse files
committed
Tests ABITracerTest now running
1 parent e924815 commit 9ecbbe0

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ public ABITrace(File ABIFile) throws IOException {
9191
while ((b = bis.read()) >= 0) {
9292
baos.write(b);
9393
}
94-
bis.close();
95-
fis.close();
96-
baos.close();
94+
bis.close(); fis.close(); baos.close();
9795
bytes = baos.toByteArray();
9896
initData(bytes);
9997
}
@@ -533,7 +531,7 @@ private boolean isABI() {
533531
return true;
534532
} else {
535533
for (int i = 128; i <= 130; i++) {
536-
ABI[i] = (char) TraceData[i];
534+
ABI[i-128] = (char) TraceData[i];
537535
}
538536
if (ABI[0] == 'A' && (ABI[1] == 'B' && ABI[2] == 'I')) {
539537
MacJunk = 128;

biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/ABITracerTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@
2424
import java.io.File;
2525
import java.net.URL;
2626
import org.junit.*;
27-
import org.slf4j.Logger;
28-
import org.slf4j.LoggerFactory;
2927

3028
public class ABITracerTest {
3129

32-
private final static Logger logger = LoggerFactory.getLogger(ABITracerTest.class);
30+
private String filePath = System.getProperty("user.dir") + "/src/test/resources/3730.ab1";
3331

3432
public ABITracerTest() {
3533
}
@@ -51,22 +49,24 @@ public void tearDown() {
5149
}
5250

5351
/**
54-
* Test of local method, of class ABITracer.
52+
* Test of URL method, of class ABITracer.
5553
*/
5654
@Test
5755
public void testURL() throws Exception {
58-
URL url = new URL("https://github.com/biopython/biopython/blob/master/Tests/Abi/3730.ab1");
56+
File file = new File(filePath);
57+
Assert.assertNotNull(file);
58+
URL url = file.toURI().toURL();
5959
Assert.assertNotNull(url);
6060
ABITrace tracer = new ABITrace(url);
6161
Assert.assertNotNull(tracer);
6262
}
6363

6464
/**
65-
* Test of local method, of class ABITracer.
65+
* Test of Local file method, of class ABITracer.
6666
*/
6767
@Test
6868
public void testLocal() throws Exception {
69-
File file = new File("/3730.ab1");
69+
File file = new File(filePath);
7070
Assert.assertNotNull(file);
7171
ABITrace tracer = new ABITrace(file);
7272
Assert.assertNotNull(tracer);

0 commit comments

Comments
 (0)