@Test public void testValueOfTaskResult_ExceptionNoMessage() throws Throwable { SchedulerRestInterface restInterface = new SchedulerStateRest(); SchedulerProxyUserInterface mockOfScheduler = mock(SchedulerProxyUserInterface.class); String sessionId = SharedSessionStoreTestUtils.createValidSession(mockOfScheduler); TaskResultImpl taskResultWithException = new TaskResultImpl( TaskIdImpl.createTaskId(JobIdImpl.makeJobId("42"), "mytask", 1), null, new byte[0], null); when(mockOfScheduler.getTaskResult("42", "mytask")).thenReturn(taskResultWithException); String exceptionStackTrace = (String) restInterface.valueOftaskresult(sessionId, "42", "mytask"); assertNotNull(exceptionStackTrace); }
@Test public void testValueOfJobResult_ExceptionNoMessage() throws Throwable { SchedulerRestInterface restInterface = new SchedulerStateRest(); SchedulerProxyUserInterface mockOfScheduler = mock(SchedulerProxyUserInterface.class); String sessionId = SharedSessionStoreTestUtils.createValidSession(mockOfScheduler); TaskResultImpl taskResultWithException = new TaskResultImpl( TaskIdImpl.createTaskId(JobIdImpl.makeJobId("42"), "mytask", 1), null, new byte[0], null); JobResultImpl jobResultWithException = new JobResultImpl(); jobResultWithException.addTaskResult("mytask", taskResultWithException, false); when(mockOfScheduler.getJobResult("42")).thenReturn(jobResultWithException); Map<String, String> jobResult = restInterface.jobResultValue(sessionId, "42"); String exceptionStackTrace = jobResult.get("mytask"); assertNotNull(exceptionStackTrace); }