File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
src/test/java/org/ipfs/api Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 1
1
package org .ipfs .api ;
2
2
3
3
import java .io .*;
4
- import java .util .Arrays ;
5
- import java .util .List ;
6
- import java .util .Map ;
7
- import java .util .Optional ;
8
- import java .util .Random ;
4
+ import java .nio .file .*;
5
+ import java .util .*;
9
6
10
7
import static org .junit .Assert .assertTrue ;
11
8
@@ -65,8 +62,13 @@ public void hugeFileStreamTest() {
65
62
}
66
63
67
64
@ org .junit .Test
68
- public void hostFileTest () {
69
- NamedStreamable hostFile = new NamedStreamable .FileWrapper (new File ("Makefile" ));
65
+ public void hostFileTest () throws IOException {
66
+ Path tempFile = Files .createTempFile ("IPFS" , "tmp" );
67
+ BufferedWriter w = new BufferedWriter (new FileWriter (tempFile .toFile ()));
68
+ w .append ("Some data" );
69
+ w .flush ();
70
+ w .close ();
71
+ NamedStreamable hostFile = new NamedStreamable .FileWrapper (tempFile .toFile ());
70
72
fileTest (hostFile );
71
73
}
72
74
@@ -348,7 +350,9 @@ public void diagTest() {
348
350
public void toolsTest () {
349
351
try {
350
352
String version = ipfs .version ();
351
- assertTrue (version .equals ("0.4.0-dev" )); // No longer works with any 0.3 version
353
+ int major = Integer .parseInt (version .split ("\\ ." )[0 ]);
354
+ int minor = Integer .parseInt (version .split ("\\ ." )[1 ]);
355
+ assertTrue (major >= 0 && minor >= 4 ); // Requires at least 0.4.0
352
356
Map commands = ipfs .commands ();
353
357
} catch (IOException e ) {
354
358
throw new RuntimeException (e );
You can’t perform that action at this time.
0 commit comments