Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,7 @@ default Task<Task<?>> anyOf(Task<?>... tasks) {
* @param zonedDateTime timestamp with specific zone when the timer should expire
* @return a new {@code Task} that completes after the specified delay
*/
default Task<Void> createTimer(ZonedDateTime zonedDateTime) {
throw new UnsupportedOperationException("This method is not implemented.");
}

Task<Void> createTimer(ZonedDateTime zonedDateTime);

/**
* Gets the deserialized input of the current task orchestration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import java.time.Duration;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.UUID;

Expand Down Expand Up @@ -189,6 +190,11 @@ public Task<Void> createTimer(Duration duration) {
return this.innerContext.createTimer(duration);
}

@Override
public Task<Void> createTimer(ZonedDateTime zonedDateTime) {
return this.innerContext.createTimer(zonedDateTime);
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,10 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.*;

public class DefaultWorkflowContextTest {
private DefaultWorkflowContext context;
Expand Down Expand Up @@ -124,6 +120,11 @@ public Task<Void> createTimer(Duration duration) {
return null;
}

@Override
public Task<Void> createTimer(ZonedDateTime zonedDateTime) {
return null;
}

@Override
public <V> V getInput(Class<V> targetType) {
return null;
Expand Down Expand Up @@ -269,8 +270,10 @@ public void createTimerTest() {
}

@Test
public void createTimerWithZonedDateTimeThrowsTest() {
assertThrows(UnsupportedOperationException.class, () -> context.createTimer(ZonedDateTime.now()));
public void createTimerWithZonedDateTimeTest() {
ZonedDateTime now = ZonedDateTime.now();
context.createTimer(now);
verify(mockInnerContext, times(1)).createTimer(now);
}

@Test
Expand Down
Loading