### Question:
Receipt { public void setReceiptData(@NonNull String receiptDataFormat, @NonNull String receiptData) { this.receiptDataFormat = receiptDataFormat; this.receiptData = receiptData; } Receipt(@NonNull String receiptType);  Receipt(@NonNull String receiptType, @Nullable String receiptText); void setReceiptData(@NonNull String receiptDataFormat, @NonNull String receiptData); @NonNull String getReceiptType(); @Nullable String getReceiptText(); @Nullable String getReceiptDataFormat(); @Nullable String getReceiptData(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void canSerialiseAsPayload() { String receiptText = "{ \"blah\": \"blah\" }"; Receipt receipt = new Receipt("customer", receiptText); receipt.setReceiptData("json", receiptText); FlowEvent fe = new FlowEvent(EVENT_RECEIPT, receipt); String json = fe.toJson(); System.out.println(json); FlowEvent result = FlowEvent.fromJson(json); Receipt resultData = result.getEventData(Receipt.class); assertThat(resultData).isEqualTo(receipt); }