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 theIterablecontains the expected elements, in any order.containsInAnyOrder(SerializableMatcher<? super T>... elementMatchers) Checks that theIterablecontains elements that match the provided matchers, in any order.containsInAnyOrder(T... expectedElements) Checks that theIterablecontains the expected elements, in any order.empty()Asserts that the iterable in question is empty.booleanDeprecated.inthashCode()Deprecated.Object.hashCode()is not supported on PAssert objects.inCombinedNonLatePanes(BoundedWindow window) Creates a newPAssert.IterableAssertlike 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.IterableAssertlike this one, but with the assertion restricted to only run on panes in theGlobalWindowthat were emitted before theGlobalWindowclosed.inEarlyPane(BoundedWindow window) Creates a newPAssert.IterableAssertlike 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.IterableAssertlike 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.IterableAssertwith 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.IterableAssertlike this one, but with the assertion restricted to only run on the provided window.inOnTimePane(BoundedWindow window) Creates a newPAssert.IterableAssertlike this one, but with the assertion restricted to only run on the provided window.inWindow(BoundedWindow window) Creates a newPAssert.IterableAssertlike 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.IterableAssertCreates a newPAssert.IterableAssertlike 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
Triggerproduces 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:
inWindowin interfacePAssert.IterableAssert<T>- Returns:
- a new
PAssert.IterableAssertlike this one but with the assertion only applied to the specified window.
-
inOnlyPane
Description copied from interface:PAssert.IterableAssertCreates a newPAssert.IterableAssertlike 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
Triggermay produce output multiple times, consider instead usingPAssert.IterableAssert.inFinalPane(BoundedWindow)orPAssert.IterableAssert.inOnTimePane(BoundedWindow).- Specified by:
inOnlyPanein interfacePAssert.IterableAssert<T>- Returns:
- a new
PAssert.IterableAssertlike this one but with the assertion only applied to the specified window.
-
inFinalPane
Description copied from interface:PAssert.IterableAssertCreates a newPAssert.IterableAssertlike 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
WindowingStrategydoes 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.ClosingBehaviorof the windowing strategy (viaWindow.withAllowedLateness(Duration, ClosingBehavior)settingWindow.ClosingBehaviortoWindow.ClosingBehavior.FIRE_ALWAYS).- Specified by:
inFinalPanein interfacePAssert.IterableAssert<T>- Returns:
- a new
PAssert.IterableAssertlike this one but with the assertion only applied to the specified window.
-
inOnTimePane
Description copied from interface:PAssert.IterableAssertCreates a newPAssert.IterableAssertlike this one, but with the assertion restricted to only run on the provided window.- Specified by:
inOnTimePanein interfacePAssert.IterableAssert<T>- Returns:
- a new
PAssert.IterableAssertlike this one but with the assertion only applied to the specified window.
-
inEarlyPane
Description copied from interface:PAssert.IterableAssertCreates a newPAssert.IterableAssertlike 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:
inEarlyPanein interfacePAssert.IterableAssert<T>- Returns:
- a new
PAssert.IterableAssertlike this one but with the assertion only applied to the specified window.
-
inLatePane
Description copied from interface:PAssert.IterableAssertCreates a newPAssert.IterableAssertwith the assertion restricted to only run on the provided window across all panes that were produced by the arrival of late data.- Specified by:
inLatePanein interfacePAssert.IterableAssert<T>- Returns:
- a new
PAssert.IterableAssertlike this one but with the assertion only applied to the specified window.
-
inCombinedNonLatePanes
Description copied from interface:PAssert.IterableAssertCreates a newPAssert.IterableAssertlike 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:
inCombinedNonLatePanesin interfacePAssert.IterableAssert<T>- Returns:
- a new
PAssert.IterableAssertlike this one but with the assertion only applied to the specified window.
-
inEarlyGlobalWindowPanes
Description copied from interface:PAssert.IterableAssertCreates a newPAssert.IterableAssertlike this one, but with the assertion restricted to only run on panes in theGlobalWindowthat were emitted before theGlobalWindowclosed. These panes havePaneInfo.Timing.EARLY.- Specified by:
inEarlyGlobalWindowPanesin interfacePAssert.IterableAssert<T>
-
containsInAnyOrder
@SafeVarargs public final PAssert.PCollectionContentsAssert<T> containsInAnyOrder(T... expectedElements) Checks that theIterablecontains the expected elements, in any order.Returns this
IterableAssert.- Specified by:
containsInAnyOrderin interfacePAssert.IterableAssert<T>- Returns:
- the same
PAssert.IterableAssertbuilder for further assertions
-
containsInAnyOrder
Checks that theIterablecontains the expected elements, in any order.Returns this
IterableAssert.- Specified by:
containsInAnyOrderin interfacePAssert.IterableAssert<T>- Returns:
- the same
PAssert.IterableAssertbuilder for further assertions
-
empty
Description copied from interface:PAssert.IterableAssertAsserts that the iterable in question is empty.- Specified by:
emptyin interfacePAssert.IterableAssert<T>- Returns:
- the same
PAssert.IterableAssertbuilder for further assertions
-
satisfies
public PAssert.PCollectionContentsAssert<T> satisfies(SerializableFunction<Iterable<T>, Void> checkerFn) Description copied from interface:PAssert.IterableAssertApplies the provided checking function (presumably containing assertions) to the iterable in question.- Specified by:
satisfiesin interfacePAssert.IterableAssert<T>- Returns:
- the same
PAssert.IterableAssertbuilder for further assertions
-
containsInAnyOrder
@SafeVarargs public final PAssert.PCollectionContentsAssert<T> containsInAnyOrder(SerializableMatcher<? super T>... elementMatchers) Checks that theIterablecontains elements that match the provided matchers, in any order.Returns this
IterableAssert.- Specified by:
containsInAnyOrderin interfacePAssert.IterableAssert<T>- Returns:
- the same
PAssert.IterableAssertbuilder for further assertions
-
containsInAnyOrder
Description copied from interface:PAssert.IterableAssertAsserts that the iterable in question is empty.- Specified by:
containsInAnyOrderin interfacePAssert.IterableAssert<T>- Returns:
- the same
PAssert.IterableAssertbuilder 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:
equalsin classObject- Throws:
UnsupportedOperationException- always
-
hashCode
Deprecated.Object.hashCode()is not supported on PAssert objects.- Overrides:
hashCodein classObject- Throws:
UnsupportedOperationException- always.
-
Object.equals(Object)is not supported on PAssert objects.