abhishekmjain commented on code in PR #4130:
URL: https://github.com/apache/gobblin/pull/4130#discussion_r2273040627


##########
gobblin-service/src/test/java/org/apache/gobblin/service/modules/scheduler/GobblinServiceJobSchedulerTest.java:
##########
@@ -120,6 +117,70 @@ public void testIsNextRunWithinRangeToSchedule() {
 
   }
 
+  /**
+   * Test that demonstrates the NullPointerException issue in 
GobblinServiceJob.executeImpl
+   * when getNextFireTime() returns null for a one-time scheduled flow.
+   */
+  @Test
+  public void testGobblinServiceJobExecuteImplWithNullNextFireTime()
+      throws Exception {
+    // Create a mock JobExecutionContext
+    org.quartz.JobExecutionContext mockContext = 
mock(org.quartz.JobExecutionContext.class);
+    org.quartz.JobDetail mockJobDetail = mock(org.quartz.JobDetail.class);
+    org.quartz.JobDataMap mockJobDataMap = mock(org.quartz.JobDataMap.class);
+    org.quartz.Trigger mockTrigger = mock(org.quartz.Trigger.class);
+
+    // Mock the job detail and data map
+    when(mockContext.getJobDetail()).thenReturn(mockJobDetail);
+    when(mockContext.getTrigger()).thenReturn(mockTrigger);
+    when(mockJobDetail.getJobDataMap()).thenReturn(mockJobDataMap);
+    when(mockJobDetail.getKey()).thenReturn(new org.quartz.JobKey("testFlow", 
"testGroup"));
+
+    // Mock the job data map contents
+    Properties jobProps = new Properties();
+    jobProps.setProperty(ConfigurationKeys.FLOW_NAME_KEY, "testFlow");
+    jobProps.setProperty(ConfigurationKeys.FLOW_GROUP_KEY, "testGroup");
+    
jobProps.setProperty(ConfigurationKeys.ORCHESTRATOR_TRIGGER_EVENT_TIME_MILLIS_KEY,
 "0");

Review Comment:
   nit: setting `ORCHESTRATOR_TRIGGER_EVENT_TIME_MILLIS_KEY` is not needed 
right?



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