BatchOperationResult implements Parcelable { @Api(2.3) @Nullable public HaloContentInstance getData() { try { if (mSuccess && !mOperation.equals(BatchOperator.TRUNCATE)) { return HaloContentInstance.deserialize(getRawData(), Halo.instance().framework().parser()); } } catch (HaloParsingException parsingExcetion) { return null; } return null; } protected  BatchOperationResult();  BatchOperationResult(String operation, int position, boolean success, Object data); protected  BatchOperationResult(Parcel in); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); @Api(2.3) int getPosition(); @Api(2.3) boolean isSuccess(); @Api(2.3) @NonNull String getRawData(); @Api(2.3) @Nullable HaloContentInstance getData(); @Api(2.3) int getDataTruncate(); @Api(2.3) @Nullable BatchError getDataError(); @NonNull @Api(2.3) @BatchOperator.BatchOperation String getOperation(); static final Creator<BatchOperationResult> CREATOR; }
@Test public void thatCanReadSuccessData() throws JSONException { BatchOperationResult instance = new BatchOperationResult(BatchOperator.CREATE, 0, true, new JSONObject("{\n" + " \"name\": \"From Android SDK\",\n" + " \"module\": \"586a47f836a6b01300ec9f00\",\n" + " \"tags\": [],\n" + " \"archivedAt\": null,\n" + " \"removedAt\": null,\n" + " \"publishedAt\": null,\n" + " \"createdBy\": \"Editor Editor\",\n" + " \"customerId\": 1,\n" + " \"values\": {},\n" + " \"pushSchedule\": null,\n" + " \"externalId\": null,\n" + " \"revision\": 0,\n" + " \"createdAt\": 1492610860696,\n" + " \"updatedAt\": null,\n" + " \"deletedAt\": null,\n" + " \"updatedBy\": null,\n" + " \"deletedBy\": null,\n" + " \"id\": \"5874c5f06a3a0d1e00c8039d\"\n" + " }")); BatchOperationResult parcelInstance = TestUtils.testParcel(instance, BatchOperationResult.CREATOR); assertThat(instance.getData().getItemId()).isEqualTo(parcelInstance.getData().getItemId()); assertThat(instance.getData().getItemId()).isEqualTo("5874c5f06a3a0d1e00c8039d"); }