@Test public void writeAndReadFromParcelRetainsNulls() { Parcel parcel = Parcel.obtain(); request.writeToParcel(parcel, 0); parcel.setDataPosition(0); VehicleMessage createdFromParcel = VehicleMessage.CREATOR.createFromParcel(parcel); assertThat(createdFromParcel, instanceOf(DiagnosticRequest.class)); assertEquals(request, createdFromParcel); String serialized = JsonFormatter.serialize(createdFromParcel); assertThat(serialized, not(containsString("multiple_responses"))); }
@Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeValue(mMultipleResponses); out.writeValue(getFrequency()); out.writeString(getName()); }
DiagnosticRequest extends DiagnosticMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeValue(mMultipleResponses); out.writeValue(getFrequency()); out.writeString(getName()); } }
DiagnosticRequest extends DiagnosticMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeValue(mMultipleResponses); out.writeValue(getFrequency()); out.writeString(getName()); } DiagnosticRequest(int busId, int id, int mode);  DiagnosticRequest(int busId, int id, int mode, int pid); protected  DiagnosticRequest(Parcel in); protected  DiagnosticRequest(); }
DiagnosticRequest extends DiagnosticMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeValue(mMultipleResponses); out.writeValue(getFrequency()); out.writeString(getName()); } DiagnosticRequest(int busId, int id, int mode);  DiagnosticRequest(int busId, int id, int mode, int pid); protected  DiagnosticRequest(Parcel in); protected  DiagnosticRequest(); void setMultipleResponses(boolean multipleResponses); boolean hasFrequency(); void setFrequency(Double frequency); void setName(String name); boolean getMultipleResponses(); Double getFrequency(); boolean hasName(); String getName(); static boolean containsRequiredFields(Set<String> fields); @Override boolean equals(Object obj); @Override String toString(); @Override void writeToParcel(Parcel out, int flags); }
DiagnosticRequest extends DiagnosticMessage { @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeValue(mMultipleResponses); out.writeValue(getFrequency()); out.writeString(getName()); } DiagnosticRequest(int busId, int id, int mode);  DiagnosticRequest(int busId, int id, int mode, int pid); protected  DiagnosticRequest(Parcel in); protected  DiagnosticRequest(); void setMultipleResponses(boolean multipleResponses); boolean hasFrequency(); void setFrequency(Double frequency); void setName(String name); boolean getMultipleResponses(); Double getFrequency(); boolean hasName(); String getName(); static boolean containsRequiredFields(Set<String> fields); @Override boolean equals(Object obj); @Override String toString(); @Override void writeToParcel(Parcel out, int flags); static final String ADD_ACTION_KEY; static final String CANCEL_ACTION_KEY; }