aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/gnunet/construct/SendMessageTest.java
blob: b95cc78570b475ad790638519a690d0dd62d44bf (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
33
34
package org.gnunet.construct;

import org.gnunet.core.SendMessage;
import org.gnunet.util.AbsoluteTime;
import org.gnunet.util.GnunetMessage;
import org.gnunet.util.PeerIdentity;
import org.gnunet.util.TestMessage;
import org.junit.Test;

/**
 * Regression test for a message class in org.gnunet.core
 *
 * todo: should this test be really here?
 *
 * @author Florian Dold
 */
public class SendMessageTest {

    @Test
    public void test_patch() {
        SendMessage m = new SendMessage();
        m.deadline = AbsoluteTime.FOREVER.asMessage();
        m.peer = new PeerIdentity(); // null identity
        m.payloadMessage = new GnunetMessage();
        m.payloadMessage.body = new TestMessage();
        m.payloadMessage.header = new GnunetMessage.Header();

        GnunetMessage container = new GnunetMessage();
        container.body = m;
        container.header = new GnunetMessage.Header();

        Construct.patch(container);
    }
}