@Test public void writeAndReadFromParcelWithDiagnostic() { message = new Command(request, action); Parcel parcel = Parcel.obtain(); message.writeToParcel(parcel, 0); parcel.setDataPosition(0); VehicleMessage createdFromParcel = VehicleMessage.CREATOR.createFromParcel(parcel); assertThat(createdFromParcel, instanceOf(Command.class)); assertEquals(message, createdFromParcel); }
@Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeSerializable(getCommand()); out.writeString(getAction()); out.writeParcelable(getDiagnosticRequest(), flags); out.writeInt(getBus()); out.writeByte((byte) (isEnabled() ? 1 : 0)); out.writeByte((byte) (isBypass() ? 1 : 0)); out.writeString(getFormat()); out.writeLong(getUnixTime()); }
Command extends KeyedMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeSerializable(getCommand()); out.writeString(getAction()); out.writeParcelable(getDiagnosticRequest(), flags); out.writeInt(getBus()); out.writeByte((byte) (isEnabled() ? 1 : 0)); out.writeByte((byte) (isBypass() ? 1 : 0)); out.writeString(getFormat()); out.writeLong(getUnixTime()); } }
Command extends KeyedMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeSerializable(getCommand()); out.writeString(getAction()); out.writeParcelable(getDiagnosticRequest(), flags); out.writeInt(getBus()); out.writeByte((byte) (isEnabled() ? 1 : 0)); out.writeByte((byte) (isBypass() ? 1 : 0)); out.writeString(getFormat()); out.writeLong(getUnixTime()); } Command(CommandType command, int bus, boolean enabled);  Command(CommandType command, boolean bypass, int bus);  Command(String format,CommandType command);  Command(CommandType command, long unixTime);  Command(CommandType command, String action);  Command(CommandType command);  Command(DiagnosticRequest request, String action); protected  Command(Parcel in); protected  Command(); }
Command extends KeyedMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeSerializable(getCommand()); out.writeString(getAction()); out.writeParcelable(getDiagnosticRequest(), flags); out.writeInt(getBus()); out.writeByte((byte) (isEnabled() ? 1 : 0)); out.writeByte((byte) (isBypass() ? 1 : 0)); out.writeString(getFormat()); out.writeLong(getUnixTime()); } Command(CommandType command, int bus, boolean enabled);  Command(CommandType command, boolean bypass, int bus);  Command(String format,CommandType command);  Command(CommandType command, long unixTime);  Command(CommandType command, String action);  Command(CommandType command);  Command(DiagnosticRequest request, String action); protected  Command(Parcel in); protected  Command(); CommandType getCommand(); boolean hasAction(); String getAction(); DiagnosticRequest getDiagnosticRequest(); int getBus(); void setBus(int mBus); boolean isEnabled(); void setEnabled(boolean enabled); boolean isBypass(); void setBypass(boolean bypass); String getFormat(); void setFormat(String Format); long getUnixTime(); void setUnixTime(long unixTime); @Override MessageKey getKey(); static boolean containsRequiredFields(Set<String> fields); @Override boolean equals(Object obj); @Override String toString(); @Override void writeToParcel(Parcel out, int flags); }
Command extends KeyedMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeSerializable(getCommand()); out.writeString(getAction()); out.writeParcelable(getDiagnosticRequest(), flags); out.writeInt(getBus()); out.writeByte((byte) (isEnabled() ? 1 : 0)); out.writeByte((byte) (isBypass() ? 1 : 0)); out.writeString(getFormat()); out.writeLong(getUnixTime()); } Command(CommandType command, int bus, boolean enabled);  Command(CommandType command, boolean bypass, int bus);  Command(String format,CommandType command);  Command(CommandType command, long unixTime);  Command(CommandType command, String action);  Command(CommandType command);  Command(DiagnosticRequest request, String action); protected  Command(Parcel in); protected  Command(); CommandType getCommand(); boolean hasAction(); String getAction(); DiagnosticRequest getDiagnosticRequest(); int getBus(); void setBus(int mBus); boolean isEnabled(); void setEnabled(boolean enabled); boolean isBypass(); void setBypass(boolean bypass); String getFormat(); void setFormat(String Format); long getUnixTime(); void setUnixTime(long unixTime); @Override MessageKey getKey(); static boolean containsRequiredFields(Set<String> fields); @Override boolean equals(Object obj); @Override String toString(); @Override void writeToParcel(Parcel out, int flags);  }