aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/gnunet/util/PeerIdentityTest.java
blob: 7dd8c9558226df6124cdcb39334e53c707f94168 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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);
    }

    /**
     * Test that new encoding works (test string from Ilya Migal)
     */
    @Test
    public void test_ilya() {
        PeerIdentity peerIdentity = PeerIdentity.fromString("NF0QZQSD5JEAXTK701H84YP0D2K0ZRM7GYA7MN2RFBJDJPVVYM90");
        Assert.assertNotNull(peerIdentity);
    }

}