gemini-code-assist[bot] commented on code in PR #38878:
URL: https://github.com/apache/beam/pull/38878#discussion_r3383457045


##########
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ParDoTest.java:
##########
@@ -7335,11 +7335,15 @@ public void onTimer(
             @OnWindowExpiration
             public void onWindowExpiration(
                 @AlwaysFetched @StateId(stateId) ValueState<Integer> state,
+                BoundedWindow window,
                 @Key String key,
+                OnWindowExpirationContext context,
                 OutputReceiver<Integer> r) {
               Integer currentValue = MoreObjects.firstNonNull(state.read(), 0);
               // verify state
               assertEquals(1, (int) currentValue);
+              Preconditions.checkNotNull(context);

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   In unit tests, it is more idiomatic to use JUnit's `assertNotNull` instead 
of Guava's `Preconditions.checkNotNull`. `Preconditions.checkNotNull` throws a 
`NullPointerException` (which JUnit treats as an unexpected error), whereas 
`assertNotNull` throws an `AssertionError` (which JUnit treats as a test 
failure), providing better integration with test runners and clearer test 
results.
   
   ```suggestion
                 assertNotNull(context);
   ```



-- 
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]

Reply via email to