Skip to content

Commit a4aa830

Browse files
committed
fixed object patch test for non ascii data
1 parent e55846f commit a4aa830

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/test/java/org/ipfs/api/Test.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,20 @@ public void objectPatch() {
9898
throw new RuntimeException("Adding not inverse of removing link!");
9999

100100
// data tests
101-
byte[] data = "some random textual data".getBytes();
102-
// byte[] data = new byte[1024];
103-
// new Random().nextBytes(data);
101+
// byte[] data = "some random textual data".getBytes();
102+
byte[] data = new byte[1024];
103+
new Random().nextBytes(data);
104104
MerkleNode patched = ipfs.object.patch(base, "set-data", Optional.of(data), Optional.empty(), Optional.empty());
105-
MerkleNode patchedResult = ipfs.object.get(patched.hash);
106-
if (!Arrays.equals(patchedResult.data.get(), data))
105+
byte[] patchedResult = ipfs.object.data(patched.hash);
106+
if (!Arrays.equals(patchedResult, data))
107107
throw new RuntimeException("object.patch: returned data != stored data!");
108108

109109
MerkleNode twicePatched = ipfs.object.patch(patched.hash, "append-data", Optional.of(data), Optional.empty(), Optional.empty());
110-
MerkleNode twicePatchedResult = ipfs.object.get(twicePatched.hash);
110+
byte[] twicePatchedResult = ipfs.object.data(twicePatched.hash);
111111
byte[] twice = new byte[2*data.length];
112112
for (int i=0; i < 2; i++)
113113
System.arraycopy(data, 0, twice, i*data.length, data.length);
114-
if (!Arrays.equals(twicePatchedResult.data.get(), twice))
114+
if (!Arrays.equals(twicePatchedResult, twice))
115115
throw new RuntimeException("object.patch: returned data after append != stored data!");
116116

117117
} catch (IOException e) {

0 commit comments

Comments
 (0)