Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/6222#discussion_r199170668
  
    --- Diff: 
flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/job/JobSubmitHandlerTest.java
 ---
    @@ -87,4 +89,33 @@ public void testSuccessfulJobSubmission() throws 
Exception {
                handler.handleRequest(new HandlerRequest<>(request, 
EmptyMessageParameters.getInstance()), mockGateway)
                        .get();
        }
    +
    +   @Test
    +   public void testFailedJobSubmission() throws Exception {
    +           final String errorMessage = "test";
    +           DispatcherGateway mockGateway = mock(DispatcherGateway.class);
    +           when(mockGateway.submitJob(any(JobGraph.class), 
any(Time.class))).thenReturn(FutureUtils.completedExceptionally(new 
Exception(errorMessage)));
    +           GatewayRetriever<DispatcherGateway> mockGatewayRetriever = 
mock(GatewayRetriever.class);
    --- End diff --
    
    No need to create a mock. `() -> CompletableFuture.completed(mockGateway)` 
should be good enough.


---

Reply via email to