Commit 145a63f5 authored by Andre Freyssinet's avatar Andre Freyssinet

Fix JUnit test issue (#313987).

parent 108bf73c
......@@ -57,7 +57,13 @@ public class TopicForwardNotTest {
ClientMessages clientMessages = new ClientMessages(1, 2);
clientMessages.addMessage(sharedMsg);
// Verify that the message is added
Assert.assertEquals(clientMessages.getMessageCount(), 1);
Assert.assertEquals(clientMessages.getClientContext(), 1);
Assert.assertEquals(clientMessages.getRequestId(), 2);
clientMessages.setProxyId(new AgentId((short)1, (short)2, 3));
Assert.assertEquals(clientMessages.getProxyId(), new AgentId((short)1, (short)2, 3));
TopicForwardNot topicForwardNot = new TopicForwardNot(clientMessages, false);
checkEncoding(topicForwardNot);
......
......@@ -24,29 +24,38 @@ package org.objectweb.joram.mom.proxies;
import junit.framework.Assert;
import java.util.Vector;
import org.junit.Test;
import org.objectweb.joram.mom.util.MessageIdListImpl;
public class MessageIdListImplEncodingTest {
static int lsize = 3;
static Vector<String> lcontent = new Vector<String>();
@Test
public void run() throws Exception {
EncodingHelper.init();
MessageIdListImpl list = new MessageIdListImpl("testList");
for (int i = 0; i < 3; i++) {
list.add("msg" + i, true);
for (int i = 0; i < lsize; i++) {
String str = "msg" + i;
list.add(str, true);
lcontent.add(str);
}
checkEncoding(list);
// Verify the created list
Assert.assertEquals(list.size(), lsize);
for (int i = 0; i < lsize; i++) {
Assert.assertEquals(list.get(i), lcontent.get(i));
}
// Verify the list after encoding and decoding
checkEncoding(list, lsize);
}
private void checkEncoding(MessageIdListImpl list) throws Exception {
private void checkEncoding(MessageIdListImpl list, int lsize) throws Exception {
byte[] bytes = EncodingHelper.encode(list);
MessageIdListImpl listDec = (MessageIdListImpl) EncodingHelper.decode(
list.getEncodableClassId(), bytes);
MessageIdListImpl listDec = (MessageIdListImpl) EncodingHelper.decode(list.getEncodableClassId(), bytes);
Assert.assertEquals(list.size(), listDec.size());
for (int i = 0; i < list.size(); i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment