@Test void testAndMetaData() { Map<String, Object> metaDataMap = Collections.singletonMap("key", "value"); MetaData metaData = MetaData.from(metaDataMap); when(serializer.deserialize(serializedMetaData)).thenReturn(metaData); Message<Object> message = new SerializedMessage<>(eventId, serializedPayload, serializedMetaData, serializer); Message<Object> message1 = message.andMetaData(MetaData.emptyInstance()); Message<Object> message2 = message.andMetaData( MetaData.from(Collections.singletonMap("key", (Object) "otherValue"))); assertEquals(1, message1.getMetaData().size()); assertEquals("value", message1.getMetaData().get("key")); assertEquals(1, message2.getMetaData().size()); assertEquals("otherValue", message2.getMetaData().get("key")); }
@Override public SerializedMessage<T> andMetaData(Map<String, ?> metaData) { return (SerializedMessage<T>) super.andMetaData(metaData); }
SerializedMessage extends AbstractMessage<T> { @Override public SerializedMessage<T> andMetaData(Map<String, ?> metaData) { return (SerializedMessage<T>) super.andMetaData(metaData); } }
SerializedMessage extends AbstractMessage<T> { @Override public SerializedMessage<T> andMetaData(Map<String, ?> metaData) { return (SerializedMessage<T>) super.andMetaData(metaData); } SerializedMessage(String identifier, SerializedObject<?> serializedPayload,
                             SerializedObject<?> serializedMetaData, Serializer serializer);  SerializedMessage(String identifier, LazyDeserializingObject<T> payload,
                             LazyDeserializingObject<MetaData> metaData); private  SerializedMessage(SerializedMessage<T> message, LazyDeserializingObject<MetaData> newMetaData); }
SerializedMessage extends AbstractMessage<T> { @Override public SerializedMessage<T> andMetaData(Map<String, ?> metaData) { return (SerializedMessage<T>) super.andMetaData(metaData); } SerializedMessage(String identifier, SerializedObject<?> serializedPayload,
                             SerializedObject<?> serializedMetaData, Serializer serializer);  SerializedMessage(String identifier, LazyDeserializingObject<T> payload,
                             LazyDeserializingObject<MetaData> metaData); private  SerializedMessage(SerializedMessage<T> message, LazyDeserializingObject<MetaData> newMetaData); @Override T getPayload(); @Override MetaData getMetaData(); @Override Class<T> getPayloadType(); @Override SerializedMessage<T> withMetaData(Map<String, ?> metaData); @Override SerializedMessage<T> andMetaData(Map<String, ?> metaData); @SuppressWarnings("unchecked") @Override SerializedObject<R> serializePayload(Serializer serializer, Class<R> expectedRepresentation); @SuppressWarnings("unchecked") @Override SerializedObject<R> serializeMetaData(Serializer serializer, Class<R> expectedRepresentation); boolean isPayloadDeserialized(); boolean isMetaDataDeserialized(); }
SerializedMessage extends AbstractMessage<T> { @Override public SerializedMessage<T> andMetaData(Map<String, ?> metaData) { return (SerializedMessage<T>) super.andMetaData(metaData); } SerializedMessage(String identifier, SerializedObject<?> serializedPayload,
                             SerializedObject<?> serializedMetaData, Serializer serializer);  SerializedMessage(String identifier, LazyDeserializingObject<T> payload,
                             LazyDeserializingObject<MetaData> metaData); private  SerializedMessage(SerializedMessage<T> message, LazyDeserializingObject<MetaData> newMetaData); @Override T getPayload(); @Override MetaData getMetaData(); @Override Class<T> getPayloadType(); @Override SerializedMessage<T> withMetaData(Map<String, ?> metaData); @Override SerializedMessage<T> andMetaData(Map<String, ?> metaData); @SuppressWarnings("unchecked") @Override SerializedObject<R> serializePayload(Serializer serializer, Class<R> expectedRepresentation); @SuppressWarnings("unchecked") @Override SerializedObject<R> serializeMetaData(Serializer serializer, Class<R> expectedRepresentation); boolean isPayloadDeserialized(); boolean isMetaDataDeserialized();  }