@Test public void writeAndReadFromParcel() { Parcel parcel = Parcel.obtain(); message.writeToParcel(parcel, 0); parcel.setDataPosition(0); VehicleMessage createdFromParcel = VehicleMessage.CREATOR.createFromParcel(parcel); assertThat(createdFromParcel, instanceOf(NamedVehicleMessage.class)); assertEquals(message, createdFromParcel); }
@Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeString(getName()); }
NamedVehicleMessage extends KeyedMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeString(getName()); } }
NamedVehicleMessage extends KeyedMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeString(getName()); } NamedVehicleMessage(String name);  NamedVehicleMessage(Long timestamp, String name); protected  NamedVehicleMessage(Parcel in); protected  NamedVehicleMessage(); }
NamedVehicleMessage extends KeyedMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeString(getName()); } NamedVehicleMessage(String name);  NamedVehicleMessage(Long timestamp, String name); protected  NamedVehicleMessage(Parcel in); protected  NamedVehicleMessage(); String getName(); @Override int compareTo(VehicleMessage other); @Override boolean equals(Object obj); @Override MessageKey getKey(); static boolean containsRequiredFields(Set<String> fields); @Override String toString(); @Override void writeToParcel(Parcel out, int flags); }
NamedVehicleMessage extends KeyedMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeString(getName()); } NamedVehicleMessage(String name);  NamedVehicleMessage(Long timestamp, String name); protected  NamedVehicleMessage(Parcel in); protected  NamedVehicleMessage(); String getName(); @Override int compareTo(VehicleMessage other); @Override boolean equals(Object obj); @Override MessageKey getKey(); static boolean containsRequiredFields(Set<String> fields); @Override String toString(); @Override void writeToParcel(Parcel out, int flags);  }