Class PAssert.PCollectionContentsAssert<T>
- All Implemented Interfaces:
PAssert.IterableAssert<T>
- Enclosing class:
PAssert
PAssert.IterableAssert
about the contents of a PCollection
. This does not require
the runner to support side inputs.-
Constructor Summary
ConstructorsConstructorDescriptionPCollectionContentsAssert
(PCollection<T> actual, org.apache.beam.sdk.testing.PAssert.AssertionWindows rewindowingStrategy, SimpleFunction<Iterable<ValueInSingleWindow<T>>, Iterable<T>> paneExtractor, PAssert.PAssertionSite site) PCollectionContentsAssert
(PCollection<T> actual, PAssert.PAssertionSite site) -
Method Summary
Modifier and TypeMethodDescriptionAsserts that the iterable in question is empty.containsInAnyOrder
(Iterable<T> expectedElements) Checks that theIterable
contains the expected elements, in any order.containsInAnyOrder
(SerializableMatcher<? super T>... elementMatchers) Checks that theIterable
contains elements that match the provided matchers, in any order.containsInAnyOrder
(T... expectedElements) Checks that theIterable
contains the expected elements, in any order.empty()
Asserts that the iterable in question is empty.boolean
Deprecated.int
hashCode()
Deprecated.Object.hashCode()
is not supported on PAssert objects.inCombinedNonLatePanes
(BoundedWindow window) Creates a newPAssert.IterableAssert
like this one, but with the assertion restricted to only run on the provided window across all panes that were not produced by the arrival of late data.Creates a newPAssert.IterableAssert
like this one, but with the assertion restricted to only run on panes in theGlobalWindow
that were emitted before theGlobalWindow
closed.inEarlyPane
(BoundedWindow window) Creates a newPAssert.IterableAssert
like this one, but with the assertion restricted to only run on the provided window across all panes that were produced by the arrival of early data.inFinalPane
(BoundedWindow window) Creates a newPAssert.IterableAssert
like this one, but with the assertion restricted to only run on the provided window, running the checker only on the final pane for each key.inLatePane
(BoundedWindow window) Creates a newPAssert.IterableAssert
with the assertion restricted to only run on the provided window across all panes that were produced by the arrival of late data.inOnlyPane
(BoundedWindow window) Creates a newPAssert.IterableAssert
like this one, but with the assertion restricted to only run on the provided window.inOnTimePane
(BoundedWindow window) Creates a newPAssert.IterableAssert
like this one, but with the assertion restricted to only run on the provided window.inWindow
(BoundedWindow window) Creates a newPAssert.IterableAssert
like this one, but with the assertion restricted to only run on the provided window.satisfies
(SerializableFunction<Iterable<T>, Void> checkerFn) Applies the provided checking function (presumably containing assertions) to the iterable in question.
-
Constructor Details
-
PCollectionContentsAssert
-
PCollectionContentsAssert
public PCollectionContentsAssert(PCollection<T> actual, org.apache.beam.sdk.testing.PAssert.AssertionWindows rewindowingStrategy, SimpleFunction<Iterable<ValueInSingleWindow<T>>, Iterable<T>> paneExtractor, PAssert.PAssertionSite site)
-
-
Method Details
-
inWindow
Description copied from interface:PAssert.IterableAssert
Creates a newPAssert.IterableAssert
like this one, but with the assertion restricted to only run on the provided window.The assertion will concatenate all panes present in the provided window if the
Trigger
produces multiple panes. If the windowing strategy accumulates fired panes and triggers fire multple times, consider using insteadPAssert.IterableAssert.inFinalPane(BoundedWindow)
orPAssert.IterableAssert.inOnTimePane(BoundedWindow)
.- Specified by:
inWindow
in interfacePAssert.IterableAssert<T>
- Returns:
- a new
PAssert.IterableAssert
like this one but with the assertion only applied to the specified window.
-
inOnlyPane
Description copied from interface:PAssert.IterableAssert
Creates a newPAssert.IterableAssert
like this one, but with the assertion restricted to only run on the provided window.The assertion will expect outputs to be produced to the provided window exactly once. If the upstream
Trigger
may produce output multiple times, consider instead usingPAssert.IterableAssert.inFinalPane(BoundedWindow)
orPAssert.IterableAssert.inOnTimePane(BoundedWindow)
.- Specified by:
inOnlyPane
in interfacePAssert.IterableAssert<T>
- Returns:
- a new
PAssert.IterableAssert
like this one but with the assertion only applied to the specified window.
-
inFinalPane
Description copied from interface:PAssert.IterableAssert
Creates a newPAssert.IterableAssert
like this one, but with the assertion restricted to only run on the provided window, running the checker only on the final pane for each key.If the input
WindowingStrategy
does not always produce final panes, the assertion may be executed over an empty input even if the trigger has fired previously. To ensure that a final pane is always produced, set theWindow.ClosingBehavior
of the windowing strategy (viaWindow.withAllowedLateness(Duration, ClosingBehavior)
settingWindow.ClosingBehavior
toWindow.ClosingBehavior.FIRE_ALWAYS
).- Specified by:
inFinalPane
in interfacePAssert.IterableAssert<T>
- Returns:
- a new
PAssert.IterableAssert
like this one but with the assertion only applied to the specified window.
-
inOnTimePane
Description copied from interface:PAssert.IterableAssert
Creates a newPAssert.IterableAssert
like this one, but with the assertion restricted to only run on the provided window.- Specified by:
inOnTimePane
in interfacePAssert.IterableAssert<T>
- Returns:
- a new
PAssert.IterableAssert
like this one but with the assertion only applied to the specified window.
-
inEarlyPane
Description copied from interface:PAssert.IterableAssert
Creates a newPAssert.IterableAssert
like this one, but with the assertion restricted to only run on the provided window across all panes that were produced by the arrival of early data.- Specified by:
inEarlyPane
in interfacePAssert.IterableAssert<T>
- Returns:
- a new
PAssert.IterableAssert
like this one but with the assertion only applied to the specified window.
-
inLatePane
Description copied from interface:PAssert.IterableAssert
Creates a newPAssert.IterableAssert
with the assertion restricted to only run on the provided window across all panes that were produced by the arrival of late data.- Specified by:
inLatePane
in interfacePAssert.IterableAssert<T>
- Returns:
- a new
PAssert.IterableAssert
like this one but with the assertion only applied to the specified window.
-
inCombinedNonLatePanes
Description copied from interface:PAssert.IterableAssert
Creates a newPAssert.IterableAssert
like this one, but with the assertion restricted to only run on the provided window across all panes that were not produced by the arrival of late data.- Specified by:
inCombinedNonLatePanes
in interfacePAssert.IterableAssert<T>
- Returns:
- a new
PAssert.IterableAssert
like this one but with the assertion only applied to the specified window.
-
inEarlyGlobalWindowPanes
Description copied from interface:PAssert.IterableAssert
Creates a newPAssert.IterableAssert
like this one, but with the assertion restricted to only run on panes in theGlobalWindow
that were emitted before theGlobalWindow
closed. These panes havePaneInfo.Timing.EARLY
.- Specified by:
inEarlyGlobalWindowPanes
in interfacePAssert.IterableAssert<T>
-
containsInAnyOrder
@SafeVarargs public final PAssert.PCollectionContentsAssert<T> containsInAnyOrder(T... expectedElements) Checks that theIterable
contains the expected elements, in any order.Returns this
IterableAssert
.- Specified by:
containsInAnyOrder
in interfacePAssert.IterableAssert<T>
- Returns:
- the same
PAssert.IterableAssert
builder for further assertions
-
containsInAnyOrder
Checks that theIterable
contains the expected elements, in any order.Returns this
IterableAssert
.- Specified by:
containsInAnyOrder
in interfacePAssert.IterableAssert<T>
- Returns:
- the same
PAssert.IterableAssert
builder for further assertions
-
empty
Description copied from interface:PAssert.IterableAssert
Asserts that the iterable in question is empty.- Specified by:
empty
in interfacePAssert.IterableAssert<T>
- Returns:
- the same
PAssert.IterableAssert
builder for further assertions
-
satisfies
public PAssert.PCollectionContentsAssert<T> satisfies(SerializableFunction<Iterable<T>, Void> checkerFn) Description copied from interface:PAssert.IterableAssert
Applies the provided checking function (presumably containing assertions) to the iterable in question.- Specified by:
satisfies
in interfacePAssert.IterableAssert<T>
- Returns:
- the same
PAssert.IterableAssert
builder for further assertions
-
containsInAnyOrder
@SafeVarargs public final PAssert.PCollectionContentsAssert<T> containsInAnyOrder(SerializableMatcher<? super T>... elementMatchers) Checks that theIterable
contains elements that match the provided matchers, in any order.Returns this
IterableAssert
.- Specified by:
containsInAnyOrder
in interfacePAssert.IterableAssert<T>
- Returns:
- the same
PAssert.IterableAssert
builder for further assertions
-
containsInAnyOrder
Description copied from interface:PAssert.IterableAssert
Asserts that the iterable in question is empty.- Specified by:
containsInAnyOrder
in interfacePAssert.IterableAssert<T>
- Returns:
- the same
PAssert.IterableAssert
builder for further assertions
-
equals
Deprecated.Object.equals(Object)
is not supported on PAssert objects. If you meant to test object equality, use a variant ofcontainsInAnyOrder(T...)
instead.- Overrides:
equals
in classObject
- Throws:
UnsupportedOperationException
- always
-
hashCode
Deprecated.Object.hashCode()
is not supported on PAssert objects.- Overrides:
hashCode
in classObject
- Throws:
UnsupportedOperationException
- always.
-
Object.equals(Object)
is not supported on PAssert objects.