mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
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:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user