Beispiel #1
0
  @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);
  }
Beispiel #2
0
 @Test
 public void keyNotNull() {
   assertThat(message.getKey(), notNullValue());
 }
Beispiel #3
0
 @Test
 public void toStringNotNull() {
   assertThat(message.toString(), notNullValue());
 }
Beispiel #4
0
 @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());
 }
Beispiel #5
0
 @Test
 public void getDataReturnsData() {
   assertArrayEquals(data, message.getData());
 }
Beispiel #6
0
 @Test
 public void getBusReturnsBus() {
   assertEquals(bus, message.getBusId());
 }
Beispiel #7
0
 @Test
 public void getIdReturnsId() {
   assertEquals(id, message.getId());
 }