ExpectedTuples (Java Application API for IBM Streams)
Date: 2020-08-07

com.ibm.streamsx.topology.tester.spl

## Class ExpectedTuples

- java.lang.Object
- - com.ibm.streamsx.topology.tester.spl.ExpectedTuples

-     public class ExpectedTuples
      extends java.lang.Object

  List of expected tuples. Utility class to build a list of expected SPL tuples for testing.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExpectedTuples(com.ibm.streams.operator.StreamSchema schema)` Create an initially empty ExpectedTuples.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ExpectedTuples` | `add(com.ibm.streams.operator.Tuple tuple)` Add a tuple to expected list.
    `ExpectedTuples` | `addAsTuple(java.lang.Object... values)` Add a tuple to expected list.
    `Condition<java.util.List<com.ibm.streams.operator.Tuple>>` | `contents(SPLStream stream)` Create a condition for `stream` having the tuples `getTuples()` in the same order.
    `com.ibm.streams.operator.StreamSchema` | `getSchema()` Get the schema of the tuples.
    `java.util.List<com.ibm.streams.operator.Tuple>` | `getTuples()` Get the expected tuples.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ExpectedTuples

          public ExpectedTuples(com.ibm.streams.operator.StreamSchema schema)

      Create an initially empty ExpectedTuples.
      Parameters:
        `schema` -

  - ### Method Detail

    - #### getSchema

          public com.ibm.streams.operator.StreamSchema getSchema()

      Get the schema of the tuples.
      Returns:
        schema of the tuples.

    - #### getTuples

          public java.util.List<com.ibm.streams.operator.Tuple> getTuples()

      Get the expected tuples. Modifying the returned list modifies the expected tuples.
      Returns:
        list of expected tuples.

    - #### add

          public ExpectedTuples add(com.ibm.streams.operator.Tuple tuple)

      Add a tuple to expected list. The schema of the tuple must be the same as `getSchema()`.
      Parameters:
        `tuple` - Tuple to be added to expected list.
      Returns:
        This.

    - #### addAsTuple

          public ExpectedTuples addAsTuple(java.lang.Object... values)

      Add a tuple to expected list. Equivalent to: `add(getSchema().getTuple(values))` with the exception that if an attribute is of type `rstring` then a String object may be used.

      Calls can be chained together to add multiple tuples. For example with a schema of `tuple<rstring id, int32 value>` this may be used to add two tuples:

           ExpectedTuples expected = new ExpectedTuples(schema);

           expected.addAsTuple("a21", 33).addAsTuple("c43", 932);

      Parameters:
        `values` - Attribute values for the tuple.
      Returns:
        This.

    - #### contents

          public Condition<java.util.List<com.ibm.streams.operator.Tuple>> contents(SPLStream stream)

      Create a condition for `stream` having the tuples `getTuples()` in the same order. `stream.getSchema()` must be equal to `getSchema()`.
      Parameters:
        `stream` - Stream the condition is for.
      Returns:
        Condition that will be valid if `stream` has the same tuples as `getTuples()`.
      See Also:
        `Tester.tupleContents(SPLStream, Tuple...)`