lukecwik commented on a change in pull request #11199: [BEAM-9562] Update Timer 
encoding with respect of dynamic timers
URL: https://github.com/apache/beam/pull/11199#discussion_r402432966
 
 

 ##########
 File path: 
runners/core-construction-java/src/test/java/org/apache/beam/runners/core/construction/TimerTest.java
 ##########
 @@ -36,39 +38,121 @@
   private static final Instant INSTANT = Instant.now();
 
   @Test
-  public void testTimer() {
-    Timer<Void> timerA = Timer.of(INSTANT);
-    assertEquals(INSTANT, timerA.getTimestamp());
-    assertNull(timerA.getPayload());
+  public void testClearTimer() {
+    Timer<String> clearedTimer = Timer.cleared("timer", "tag");
+    assertTrue(clearedTimer.getClearBit());
+    assertEquals("timer", clearedTimer.getUserKey());
+    assertEquals("tag", clearedTimer.getDynamicTimerTag());
+  }
 
-    Timer<String> timerB = Timer.of(INSTANT, "ABC");
-    assertEquals(INSTANT, timerB.getTimestamp());
-    assertEquals("ABC", timerB.getPayload());
+  @Test
+  public void testTimer() {
+    Timer<String> timer =
+        Timer.of(
+            "key",
+            "tag",
+            INSTANT,
+            INSTANT,
+            Collections.singleton(GlobalWindow.INSTANCE),
+            PaneInfo.NO_FIRING);
+    assertEquals("key", timer.getUserKey());
+    assertEquals("tag", timer.getDynamicTimerTag());
+    assertEquals(INSTANT, timer.getFireTimestamp());
+    assertEquals(INSTANT, timer.getHoldTimestamp());
+    assertEquals(Collections.singleton(GlobalWindow.INSTANCE), 
timer.getWindows());
+    assertEquals(PaneInfo.NO_FIRING, timer.getPane());
+    assertFalse(timer.getClearBit());
   }
 
   @Test
-  public void testTimerCoderWithInconsistentWithEqualsPayloadCoder() throws 
Exception {
-    Coder<Timer<byte[]>> coder = Timer.Coder.of(ByteArrayCoder.of());
+  public void testTimerCoderWithInconsistentWithEqualsComponentCoders() throws 
Exception {
+    Coder<Timer<String>> coder = Timer.Coder.of(StringUtf8Coder.of(), 
GlobalWindow.Coder.INSTANCE);
     CoderProperties.coderSerializable(coder);
     CoderProperties.structuralValueDecodeEncodeEqual(
 
 Review comment:
   Add a cleared timer for this case.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to