/**
* test method setMessage(int, byte[], int)
*
*/
public void test_setMessage2() throws Exception {
SysexMessage message = new SysexMessage();
try {
message.setMessage(34, new byte[] {1, 2}, 2);
fail("InvalidMidiDataException expected");
} catch (InvalidMidiDataException e) {}
/*
* it's all right
*/
message.setMessage(240, new byte[] {1, 2}, 2);
message.setMessage(247, new byte[] {34, -42}, 2);
assertEquals(3, message.getLength());
assertEquals(247, message.getStatus());
assertEquals(3, message.getMessage().length);
assertEquals(-9, message.getMessage()[0]);
assertEquals(34, message.getMessage()[1]);
assertEquals(-42, message.getMessage()[2]);
assertEquals(2, message.getData().length);
assertEquals(34, message.getData()[0]);
assertEquals(-42, message.getData()[1]);
message.setMessage(240, new byte[] {12, 47, -9}, 1);
assertEquals(2, message.getLength());
assertEquals(240, message.getStatus());
assertEquals(2, message.getMessage().length);
assertEquals(-16, message.getMessage()[0]);
assertEquals(12, message.getMessage()[1]);
assertEquals(1, message.getData().length);
assertEquals(12, message.getData()[0]);
message.setMessage(240, new byte[] {12, 4, 9}, 0);
assertEquals(1, message.getLength());
assertEquals(240, message.getStatus());
assertEquals(1, message.getMessage().length);
assertEquals(-16, message.getMessage()[0]);
assertEquals(0, message.getData().length);
try {
message.setMessage(247, new byte[] {1, 2, 3}, 4);
fail("IndexOutOfBoundsException expected");
} catch (IndexOutOfBoundsException e) {}
try {
message.setMessage(247, new byte[] {1, 2, 3}, -1);
fail("IndexOutOfBoundsException expected");
} catch (IndexOutOfBoundsException e) {}
message.setMessage(247, new byte[0], 0);
assertEquals(1, message.getLength());
assertEquals(247, message.getStatus());
assertEquals(1, message.getMessage().length);
assertEquals(-9, message.getMessage()[0]);
assertEquals(0, message.getData().length);
try {
message.setMessage(247, null, 0);
fail("NullPointerException expected");
} catch (NullPointerException e) {}
}