@Test public void writeAndReadFromParcel() { Parcel parcel = Parcel.obtain(); message.writeToParcel(parcel, 0); // Reset parcel for reading parcel.setDataPosition(0); VehicleMessage createdFromParcel = VehicleMessage.CREATOR.createFromParcel(parcel); assertThat(createdFromParcel, instanceOf(CanMessage.class)); assertEquals(message, createdFromParcel); }
@Test public void keyNotNull() { assertThat(message.getKey(), notNullValue()); }
@Test public void toStringNotNull() { assertThat(message.toString(), notNullValue()); }
@Test public void setNoData() { message = new CanMessage(bus, id, null); assertThat(message.getData(), notNullValue()); assertArrayEquals(new byte[] {0, 0, 0, 0, 0, 0, 0, 0}, message.getData()); }
@Test public void getDataReturnsData() { assertArrayEquals(data, message.getData()); }
@Test public void getBusReturnsBus() { assertEquals(bus, message.getBusId()); }
@Test public void getIdReturnsId() { assertEquals(id, message.getId()); }