File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ class FileWrapper implements NamedStreamable {
29
29
private final File source ;
30
30
31
31
public FileWrapper (File source ) {
32
+ if (! source .exists ())
33
+ throw new IllegalStateException ("File does not exist: " + source );
32
34
this .source = source ;
33
35
}
34
36
Original file line number Diff line number Diff line change @@ -22,16 +22,17 @@ public class APITest {
22
22
23
23
@ Test
24
24
public void dag () throws IOException {
25
- byte [] object = "{\" data\" :1234}" .getBytes ();
25
+ String original = "{\" data\" :1234}" ;
26
+ byte [] object = original .getBytes ();
26
27
MerkleNode put = ipfs .dag .put ("json" , object );
27
28
28
- Cid expected = Cid .decode ("zdpuB2CbdLrUK5AgZusm4hraisDDDC135ugdmZWvMHhhsSYTb " );
29
+ Cid expected = Cid .decode ("zdpuAs3whHmb9T1NkHSLGF45ykcKrEBxSLiEx6YpLzmKbQLEB " );
29
30
30
31
Multihash result = put .hash ;
31
32
Assert .assertTrue ("Correct cid returned" , result .equals (expected ));
32
33
33
34
byte [] get = ipfs .dag .get (expected );
34
- Assert .assertTrue ("Raw data equal" , Arrays .equals (object , get ));
35
+ Assert .assertTrue ("Raw data equal" , original .equals (new String ( get ). trim () ));
35
36
}
36
37
37
38
@ Test
You can’t perform that action at this time.
0 commit comments