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 11package org .ipfs .api ;
22
33import 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 .*;
96
107import static org .junit .Assert .assertTrue ;
118
@@ -65,8 +62,13 @@ public void hugeFileStreamTest() {
6562 }
6663
6764 @ 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 ());
7072 fileTest (hostFile );
7173 }
7274
@@ -348,7 +350,9 @@ public void diagTest() {
348350 public void toolsTest () {
349351 try {
350352 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
352356 Map commands = ipfs .commands ();
353357 } catch (IOException e ) {
354358 throw new RuntimeException (e );
You can’t perform that action at this time.
0 commit comments