protected static class PAssert.PCollectionContentsAssert<T> extends java.lang.Object implements PAssert.IterableAssert<T>
PAssert.IterableAssert
about the contents of a PCollection
. This does not require
the runner to support side inputs.Modifier and Type | Class and Description |
---|---|
protected static class |
PAssert.PCollectionContentsAssert.MatcherCheckerFn<T>
Check that the passed-in matchers match the existing data.
|
Constructor and Description |
---|
PCollectionContentsAssert(PCollection<T> actual,
org.apache.beam.sdk.testing.PAssert.AssertionWindows rewindowingStrategy,
SimpleFunction<java.lang.Iterable<ValueInSingleWindow<T>>,java.lang.Iterable<T>> paneExtractor,
PAssert.PAssertionSite site) |
PCollectionContentsAssert(PCollection<T> actual,
PAssert.PAssertionSite site) |
Modifier and Type | Method and Description |
---|---|
PAssert.PCollectionContentsAssert<T> |
containsInAnyOrder(java.lang.Iterable<T> expectedElements)
Checks that the
Iterable contains the expected elements, in any order. |
PAssert.PCollectionContentsAssert<T> |
containsInAnyOrder(T... expectedElements)
Checks that the
Iterable contains the expected elements, in any order. |
PAssert.PCollectionContentsAssert<T> |
empty()
Asserts that the iterable in question is empty.
|
boolean |
equals(java.lang.Object o)
Deprecated.
Object.equals(Object) is not supported on PAssert objects. If you meant
to test object equality, use a variant of containsInAnyOrder(T...) instead. |
int |
hashCode()
Deprecated.
Object.hashCode() is not supported on PAssert objects. |
PAssert.PCollectionContentsAssert<T> |
inCombinedNonLatePanes(BoundedWindow window)
Creates a new
PAssert.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. |
PAssert.IterableAssert<T> |
inEarlyGlobalWindowPanes()
Creates a new
PAssert.IterableAssert like this one, but with the assertion restricted to only
run on panes in the GlobalWindow that were emitted before the GlobalWindow
closed. |
PAssert.PCollectionContentsAssert<T> |
inFinalPane(BoundedWindow window)
Creates a new
PAssert.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. |
PAssert.PCollectionContentsAssert<T> |
inOnTimePane(BoundedWindow window)
Creates a new
PAssert.IterableAssert like this one, but with the assertion restricted to only
run on the provided window. |
PAssert.PCollectionContentsAssert<T> |
inWindow(BoundedWindow window)
Creates a new
PAssert.IterableAssert like this one, but with the assertion restricted to only
run on the provided window. |
PAssert.PCollectionContentsAssert<T> |
satisfies(SerializableFunction<java.lang.Iterable<T>,java.lang.Void> checkerFn)
Applies the provided checking function (presumably containing assertions) to the
iterable in question.
|
public PCollectionContentsAssert(PCollection<T> actual, PAssert.PAssertionSite site)
public PCollectionContentsAssert(PCollection<T> actual, org.apache.beam.sdk.testing.PAssert.AssertionWindows rewindowingStrategy, SimpleFunction<java.lang.Iterable<ValueInSingleWindow<T>>,java.lang.Iterable<T>> paneExtractor, PAssert.PAssertionSite site)
public PAssert.PCollectionContentsAssert<T> inWindow(BoundedWindow window)
PAssert.IterableAssert
PAssert.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 instead PAssert.IterableAssert.inFinalPane(BoundedWindow)
or PAssert.IterableAssert.inOnTimePane(BoundedWindow)
.
inWindow
in interface PAssert.IterableAssert<T>
PAssert.IterableAssert
like this one but with the assertion only applied to the
specified window.public PAssert.PCollectionContentsAssert<T> inFinalPane(BoundedWindow window)
PAssert.IterableAssert
PAssert.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 the Window.ClosingBehavior
of the windowing strategy
(via Window.withAllowedLateness(Duration, ClosingBehavior)
setting
Window.ClosingBehavior
to Window.ClosingBehavior.FIRE_ALWAYS
).
inFinalPane
in interface PAssert.IterableAssert<T>
PAssert.IterableAssert
like this one but with the assertion only applied to the
specified window.public PAssert.PCollectionContentsAssert<T> inOnTimePane(BoundedWindow window)
PAssert.IterableAssert
PAssert.IterableAssert
like this one, but with the assertion restricted to only
run on the provided window.inOnTimePane
in interface PAssert.IterableAssert<T>
PAssert.IterableAssert
like this one but with the assertion only applied to the
specified window.public PAssert.PCollectionContentsAssert<T> inCombinedNonLatePanes(BoundedWindow window)
PAssert.IterableAssert
PAssert.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.inCombinedNonLatePanes
in interface PAssert.IterableAssert<T>
PAssert.IterableAssert
like this one but with the assertion only applied to the
specified window.public PAssert.IterableAssert<T> inEarlyGlobalWindowPanes()
PAssert.IterableAssert
PAssert.IterableAssert
like this one, but with the assertion restricted to only
run on panes in the GlobalWindow
that were emitted before the GlobalWindow
closed. These panes have PaneInfo.Timing.EARLY
.inEarlyGlobalWindowPanes
in interface PAssert.IterableAssert<T>
@SafeVarargs public final PAssert.PCollectionContentsAssert<T> containsInAnyOrder(T... expectedElements)
Iterable
contains the expected elements, in any order.
Returns this IterableAssert
.
containsInAnyOrder
in interface PAssert.IterableAssert<T>
PAssert.IterableAssert
builder for further assertionspublic PAssert.PCollectionContentsAssert<T> containsInAnyOrder(java.lang.Iterable<T> expectedElements)
Iterable
contains the expected elements, in any order.
Returns this IterableAssert
.
containsInAnyOrder
in interface PAssert.IterableAssert<T>
PAssert.IterableAssert
builder for further assertionspublic PAssert.PCollectionContentsAssert<T> empty()
PAssert.IterableAssert
empty
in interface PAssert.IterableAssert<T>
PAssert.IterableAssert
builder for further assertionspublic PAssert.PCollectionContentsAssert<T> satisfies(SerializableFunction<java.lang.Iterable<T>,java.lang.Void> checkerFn)
PAssert.IterableAssert
satisfies
in interface PAssert.IterableAssert<T>
PAssert.IterableAssert
builder for further assertions@Deprecated public boolean equals(java.lang.Object o)
Object.equals(Object)
is not supported on PAssert objects. If you meant
to test object equality, use a variant of containsInAnyOrder(T...)
instead.equals
in class java.lang.Object
java.lang.UnsupportedOperationException
- always@Deprecated public int hashCode()
Object.hashCode()
is not supported on PAssert objects.hashCode
in class java.lang.Object
java.lang.UnsupportedOperationException
- always.