Added boat location, and race start messages to the mock data interface

- Added proper support for signed and unsigned types. This includes automatic conversion to the correct data type (long to int, short, or byte).

- Moved code related to adding values into the byte buffer into the abstract Message class

Tags: #story[29]
This commit is contained in:
Michael Rausch
2017-04-25 21:49:51 +12:00
parent 6874f288ee
commit 1f8f1f0f86
12 changed files with 573 additions and 121 deletions
@@ -0,0 +1,26 @@
package seng302.server;
import org.junit.Test;
import seng302.server.messages.Header;
import seng302.server.messages.MessageType;
import static junit.framework.TestCase.assertTrue;
/**
* Tests message header
*/
public class TestHeader {
@Test
public void testHeaderSizeEqualsActualSize(){
Header h = new Header(MessageType.DISPLAY_TEXT_MESSAGE, 1, (short) 1);
assertTrue(h.getSize() == h.getByteBuffer().array().length);
}
@Test
public void headerSizeIsSameAsSpec(){
Header h = new Header(MessageType.DISPLAY_TEXT_MESSAGE, 1, (short) 1);
assertTrue(h.getSize() == 15); // Spec specifies 15 bytes
}
}