Assert.assertEquals(ec2.getBullets().get(2).getBulletId(), -128);
}
@Test
public void withMessages() throws IOException {
ExecCommands ec = new ExecCommands();
ec.setBodyTurnRemaining(150.123);
ec.getBullets().add(new BulletCommand(1.0, true, 0.9354, 11));
final byte[] data = new byte[20];
data[10] = 10;
ec.getTeamMessages().add(new TeamMessage("Foo", "Bar", data));
ec.getTeamMessages().add(new TeamMessage("Foo", "Bar", null));
ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
RbSerializer rbs = new RbSerializer();
rbs.serialize(out, RbSerializer.ExecCommands_TYPE, ec);
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
ExecCommands ec2 = (ExecCommands) rbs.deserialize(in);
Assert.assertEquals(ec2.getTeamMessages().get(0).message[0], 0);
Assert.assertEquals(ec2.getTeamMessages().get(0).message[10], 10);
Assert.assertEquals(ec2.getTeamMessages().get(0).sender, "Foo");
Assert.assertEquals(ec2.getTeamMessages().get(0).recipient, "Bar");
Assert.assertEquals(ec2.getTeamMessages().get(1).message, null);
}