summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2014-08-06 18:38:27 +0000
committerFlorian Dold <florian.dold@gmail.com>2014-08-06 18:38:27 +0000
commit430a7c7d6450904e5586a5ab5023c54621e73dd8 (patch)
tree95b271732399f4709bdb4fc3e42f0fbed277759e
parent78f5dc56bc9c3a515e39aaed6b97a9975fe6aa8c (diff)
test case for peer identity
-rw-r--r--src/main/java/org/gnunet/util/PeerIdentity.java1
-rw-r--r--src/test/java/org/gnunet/util/PeerIdentityTest.java23
2 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/org/gnunet/util/PeerIdentity.java b/src/main/java/org/gnunet/util/PeerIdentity.java
index 8ae6a91..60197f2 100644
--- a/src/main/java/org/gnunet/util/PeerIdentity.java
+++ b/src/main/java/org/gnunet/util/PeerIdentity.java
@@ -63,3 +63,4 @@ public class PeerIdentity implements Message {
return (p.data == null) ? null : p;
}
}
+
diff --git a/src/test/java/org/gnunet/util/PeerIdentityTest.java b/src/test/java/org/gnunet/util/PeerIdentityTest.java
new file mode 100644
index 0000000..ac09813
--- /dev/null
+++ b/src/test/java/org/gnunet/util/PeerIdentityTest.java
@@ -0,0 +1,23 @@
+package org.gnunet.util;
+
+import org.junit.Test;
+import java.util.Random;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * ...
+ *
+ * @author Florian Dold
+ */
+public class PeerIdentityTest {
+ @Test
+ public void test_str() {
+ PeerIdentity peerIdentity = new PeerIdentity();
+ new Random().nextBytes(peerIdentity.data);
+ PeerIdentity peerIdentity2 = PeerIdentity.fromString(peerIdentity.toString());
+ Assert.assertArrayEquals(peerIdentity.data, peerIdentity2.data);
+ }
+
+}
+