kennknowles commented on a change in pull request #16668:
URL: https://github.com/apache/beam/pull/16668#discussion_r796620678
##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/testing/PAssert.java
##########
@@ -340,6 +353,20 @@ public int hashCode() {
/** Builder interface for assertions applicable to a single value. */
public interface SingletonAssert<T> {
+ /**
+ * Creates a new {@link SingletonAssert} like this one, but with the
assertion restricted to
+ * only run on the provided window.
+ *
+ * <p>The assertion will concatenate all panes present in the provided
window if the {@link
Review comment:
This assertion sort of applies to multiple values inherently, so that is
probably why it wasn't present.
##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/testing/PAssert.java
##########
@@ -233,6 +233,19 @@ public int hashCode() {
*/
IterableAssert<T> inWindow(BoundedWindow window);
+ /**
+ * Creates a new {@link IterableAssert} like this one, but with the
assertion restricted to only
+ * run on the provided window.
+ *
+ * <p>The assertion will expect outputs to be produced to the provided
window exactly once. If
+ * the upstream {@link Trigger} may produce output multiple times,
consider instead using {@link
+ * #inFinalPane(BoundedWindow)} or {@link #inOnTimePane(BoundedWindow)}.
+ *
+ * @return a new {@link IterableAssert} like this one but with the
assertion only applied to the
+ * specified window.
+ */
+ IterableAssert<T> inOnlyPane(BoundedWindow window);
Review comment:
I double checked that adequate validation is in place to ensure this is
not applied when there is more than one pane. Curiously the validation occurs
on the `PaneInfo` of emitted elements rather than by examining the trigger. But
anyhow this one seems safe enough.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]