private static ClusterClient<String> createClusterClient(@Nullable Exception exception) throws Exception { final ClusterClient<String> clusterClient = mock(ClusterClient.class); if (exception != null) { doThrow(exception).when(clusterClient).stop(any(JobID.class)); } return clusterClient; } }
clusterClient.stop(id);
@Test public void testStop() throws Exception { // test stop properly JobID jid = new JobID(); String jidString = jid.toString(); String[] parameters = { jidString }; final ClusterClient<String> clusterClient = createClusterClient(null); MockedCliFrontend testFrontend = new MockedCliFrontend(clusterClient); testFrontend.stop(parameters); Mockito.verify(clusterClient, times(1)).stop(any(JobID.class)); }
clusterClient -> { try { clusterClient.stop(jobId); } catch (Exception e) { throw new FlinkException("Could not stop the job " + jobId + '.', e);
clusterClient -> { try { clusterClient.stop(jobId); } catch (Exception e) { throw new FlinkException("Could not stop the job " + jobId + '.', e);
clusterClient -> { try { clusterClient.stop(jobId); } catch (Exception e) { throw new FlinkException("Could not stop the job " + jobId + '.', e);