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