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

    https://github.com/apache/flink/pull/5224#discussion_r159643583
  
    --- Diff: 
flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendCancelTest.java
 ---
    @@ -133,19 +139,23 @@ public void testCancelWithSavepointWithoutJobId() 
throws Exception {
        public void testCancelWithSavepointWithoutParameters() throws Exception 
{
                // Cancel with savepoint (no target directory) and no job ID
                String[] parameters = { "-s" };
    -           CliFrontend testFrontend = new 
CliFrontend(CliFrontendTestUtils.getConfigDir());
    +           CliFrontend testFrontend = new CliFrontend(
    +                   new Configuration(),
    +                   Collections.singletonList(new DefaultCLI()),
    +                   CliFrontendTestUtils.getConfigDir());
                testFrontend.cancel(parameters);
     
                fail("Should have failed.");
        }
     
    -   private static final class CancelTestCliFrontend extends 
MockedCliFrontend {
    +   private static ClusterClient createClusterClient(boolean reject) throws 
Exception {
    +           final ClusterClient clusterClient = mock(ClusterClient.class);
     
    -           CancelTestCliFrontend(boolean reject) throws Exception {
    -                   if (reject) {
    -                           doThrow(new IllegalArgumentException("Test 
exception")).when(client).cancel(any(JobID.class));
    -                           doThrow(new IllegalArgumentException("Test 
exception")).when(client).cancelWithSavepoint(any(JobID.class), anyString());
    -                   }
    +           if (reject) {
    +                   doThrow(new IllegalArgumentException("Test 
exception")).when(clusterClient).cancel(any(JobID.class));
    --- End diff --
    
    nit: Code will never run because `reject` is always `false` for all tests. 
Original author probably forgot to add some test cases.


---

Reply via email to