Skip to content

Commit

Permalink
forgot checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
VivaanBahl committed Feb 16, 2017
1 parent beacccc commit fedc6ea
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public class RBSMNodeTest {

private static final byte RBSM_MESSAGE_FOOTER = 0xA;

/**
* Runs setup for the test class
*/
@BeforeClass
public static void oneTimeSetup() {
messages = new LinkedBlockingQueue<>();
Expand All @@ -31,12 +34,25 @@ public static void oneTimeSetup() {
});
}

/**
* Runs setup for each test case
*/
@Before
public void setUp() {
// get a dummy RBSMNode each time
testNode = new RBSMNode(NodeChannel.STEERING, NodeChannel.STEERING, null, 100);
}

/**
* Tests the RBSM MID error translation from the bit representation to the
* error message
*
* Iterates through each known low-level error and calls peel() with a faked message
*
* Compares the output of peel() with the expected RBSMErrorCodes message format
*
* No errors expected
*/
@Test
public void testRbsmMidErrorTranslation() {
byte rbsmMidErrorHeader = (byte) 254;
Expand All @@ -63,11 +79,16 @@ public void testRbsmMidErrorTranslation() {
// make sure that we received a message
Message top = messages.poll();
assertNotNull(top);
assertEquals(((RobobuggyLogicNotificationMeasurement) top).getMessage(), "RBSM_MID_ERROR:" + errorCode.getErrorCode() + ": " + errorCode.getErrorMessage());
assertEquals(((RobobuggyLogicNotificationMeasurement) top).getMessage(),
"RBSM_MID_ERROR:" + errorCode.getErrorCode() + ": " + errorCode.getErrorMessage());
}

}

/**
* Unfortunately we can't trigger continuation very easily, so we instead just wait
* for 100 ms for peel() to finish
*/
private void waitForMessagePropagation() {
try {
Thread.sleep(100);
Expand Down

0 comments on commit fedc6ea

Please sign in to comment.