@SuppressWarnings("deprecation") @Test void testCallCodedException() throws Exception { JobExecutionContext jobExecutionContext = JobExecutionContext.builder().setAuthentication(authentication).setLocale(locale).build(); String message = "MyMessage"; String errorCode = "M01"; CodedRuntimeException codedRuntimeException = mock(CodedRuntimeException.class); when(codedRuntimeException.getLocalizedMessage()).thenReturn(message); when(codedRuntimeException.getErrorCode()).thenReturn(errorCode); doThrow(codedRuntimeException).when(job).call(progress); assertThrows( JobExecutionException.class, () -> new JobExecutionTemplate().call(job, progress, jobExecutionContext)); verify(progress).start(); verify(progress).failed("MyMessage (M01)", codedRuntimeException); }
<T> T call(Job<T> job, Progress progress, JobExecutionContext jobExecutionContext) { return runWithContext(jobExecutionContext, () -> tryCall(job, progress)); }
JobExecutionTemplate { <T> T call(Job<T> job, Progress progress, JobExecutionContext jobExecutionContext) { return runWithContext(jobExecutionContext, () -> tryCall(job, progress)); } }
JobExecutionTemplate { <T> T call(Job<T> job, Progress progress, JobExecutionContext jobExecutionContext) { return runWithContext(jobExecutionContext, () -> tryCall(job, progress)); }  }
JobExecutionTemplate { <T> T call(Job<T> job, Progress progress, JobExecutionContext jobExecutionContext) { return runWithContext(jobExecutionContext, () -> tryCall(job, progress)); }   }
JobExecutionTemplate { <T> T call(Job<T> job, Progress progress, JobExecutionContext jobExecutionContext) { return runWithContext(jobExecutionContext, () -> tryCall(job, progress)); }    }