Testing protocols

This commit is contained in:
Marcin Kostrzewski 2020-10-28 16:49:08 +01:00
parent 9c1160ca2c
commit 05af808c9b

View File

@ -0,0 +1,19 @@
package Main;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class ProtocolMessageTest {
@Test
public void protocolBothWaysTest(){
int length = 10;
char[] msg = "1234567890".toCharArray();
ProtocolMessage messageIn = new ProtocolMessage(length, msg);
char[] data = messageIn.getRaw();
ProtocolMessage messageOut = new ProtocolMessage(data);
assertEquals(length, messageOut.getLength(), "Length not right.");
assertEquals(msg, messageOut.getMessage(), "Message not right.");
}
}