Class TestRecord<K,​V>


  • public class TestRecord<K,​V>
    extends Object
    A key/value pair, including timestamp and record headers, to be sent to or received from TopologyTestDriver. If [a] record does not contain a timestamp, TestInputTopic will auto advance it's time when the record is piped.
    • Constructor Detail

      • TestRecord

        public TestRecord​(K key,
                          V value,
                          Headers headers,
                          Instant recordTime)
        Creates a record.
        Parameters:
        key - The key that will be included in the record
        value - The value of the record
        headers - the record headers that will be included in the record
        recordTime - The timestamp of the record.
      • TestRecord

        public TestRecord​(K key,
                          V value,
                          Headers headers,
                          Long timestampMs)
        Creates a record.
        Parameters:
        key - The key that will be included in the record
        value - The value of the record
        headers - the record headers that will be included in the record
        timestampMs - The timestamp of the record, in milliseconds since the beginning of the epoch.
      • TestRecord

        public TestRecord​(K key,
                          V value,
                          Instant recordTime)
        Creates a record.
        Parameters:
        key - The key of the record
        value - The value of the record
        recordTime - The timestamp of the record as Instant.
      • TestRecord

        public TestRecord​(K key,
                          V value,
                          Headers headers)
        Creates a record.
        Parameters:
        key - The key of the record
        value - The value of the record
        headers - The record headers that will be included in the record
      • TestRecord

        public TestRecord​(K key,
                          V value)
        Creates a record.
        Parameters:
        key - The key of the record
        value - The value of the record
      • TestRecord

        public TestRecord​(V value)
        Create a record with null key.
        Parameters:
        value - The value of the record
      • TestRecord

        public TestRecord​(ProducerRecord<K,​V> record)
        Create a TestRecord from a ProducerRecord.
        Parameters:
        record - The record contents
    • Method Detail

      • headers

        public Headers headers()
        Returns:
        The headers.
      • key

        public K key()
        Returns:
        The key (or null if no key is specified).
      • value

        public V value()
        Returns:
        The value.
      • timestamp

        public Long timestamp()
        Returns:
        The timestamp, which is in milliseconds since epoch.
      • getHeaders

        public Headers getHeaders()
        Returns:
        The headers.
      • getKey

        public K getKey()
        Returns:
        The key (or null if no key is specified)
      • getValue

        public V getValue()
        Returns:
        The value.
      • getRecordTime

        public Instant getRecordTime()
        Returns:
        The timestamp.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object