Skip to content
Snippets Groups Projects
Verified Commit ba592821 authored by akwizgran's avatar akwizgran
Browse files

Reduce code duplication in TestMessageFactory.

parent 74e4a9cb
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,6 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault; ...@@ -4,7 +4,6 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.bramble.api.sync.GroupId; import org.briarproject.bramble.api.sync.GroupId;
import org.briarproject.bramble.api.sync.Message; import org.briarproject.bramble.api.sync.Message;
import org.briarproject.bramble.api.sync.MessageFactory; import org.briarproject.bramble.api.sync.MessageFactory;
import org.briarproject.bramble.util.ByteUtils;
import static org.briarproject.bramble.api.sync.SyncConstants.MESSAGE_HEADER_LENGTH; import static org.briarproject.bramble.api.sync.SyncConstants.MESSAGE_HEADER_LENGTH;
...@@ -25,9 +24,6 @@ public class TestMessageFactory implements MessageFactory { ...@@ -25,9 +24,6 @@ public class TestMessageFactory implements MessageFactory {
public byte[] getRawMessage(Message m) { public byte[] getRawMessage(Message m) {
byte[] body = m.getBody(); byte[] body = m.getBody();
byte[] raw = new byte[MESSAGE_HEADER_LENGTH + body.length]; byte[] raw = new byte[MESSAGE_HEADER_LENGTH + body.length];
byte[] groupId = m.getGroupId().getBytes();
System.arraycopy(groupId, 0, raw, 0, groupId.length);
ByteUtils.writeUint64(m.getTimestamp(), raw, groupId.length);
System.arraycopy(body, 0, raw, MESSAGE_HEADER_LENGTH, body.length); System.arraycopy(body, 0, raw, MESSAGE_HEADER_LENGTH, body.length);
return raw; return raw;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment