### Question:
JobManagerRunner implements LeaderContender, OnCompletionActions, AutoCloseableAsync { @Override public void jobFinishedByOther() { resultFuture.completeExceptionally(new JobNotFinishedException(jobGraph.getJobID())); } JobManagerRunner(
			final ResourceID resourceId,
			final JobGraph jobGraph,
			final Configuration configuration,
			final RpcService rpcService,
			final HighAvailabilityServices haServices,
			final HeartbeatServices heartbeatServices,
			final BlobServer blobServer,
			final JobManagerSharedServices jobManagerSharedServices,
			final JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory,
			final FatalErrorHandler fatalErrorHandler); CompletableFuture<JobMasterGateway> getLeaderGatewayFuture(); JobGraph getJobGraph(); CompletableFuture<ArchivedExecutionGraph> getResultFuture(); void start(); @Override CompletableFuture<Void> closeAsync(); @Override void jobReachedGloballyTerminalState(ArchivedExecutionGraph executionGraph); @Override void jobFinishedByOther(); @Override void jobMasterFailed(Throwable cause); @Override void grantLeadership(final UUID leaderSessionID); @Override void revokeLeadership(); @Override String getAddress(); @Override void handleError(Exception exception);  }### Answer:
@Test public void testJobFinishedByOther() throws Exception { final JobManagerRunner jobManagerRunner = createJobManagerRunner(); try { jobManagerRunner.start(); final CompletableFuture<ArchivedExecutionGraph> resultFuture = jobManagerRunner.getResultFuture(); assertThat(resultFuture.isDone(), is(false)); jobManagerRunner.jobFinishedByOther(); try { resultFuture.get(); fail("Should have failed."); } catch (ExecutionException ee) { assertThat(ExceptionUtils.stripExecutionException(ee), instanceOf(JobNotFinishedException.class)); } } finally { jobManagerRunner.close(); } }