@Test
public void testDetachedMode() throws Exception{

	jobManagerSystem.actorOf(Props.create(SuccessReturningActor.class), JobManager.JOB_MANAGER_NAME());
	Client out = new Client(config);
	try {
		PackagedProgram prg = new PackagedProgram(TestExecuteTwice.class);
		out.runDetached(prg, 1);
		fail(FAIL_MESSAGE);
	} catch (ProgramInvocationException e) {
		assertEquals(
				DetachedJobExecutionResult.DETACHED_MESSAGE + DetachedJobExecutionResult.EXECUTE_TWICE_MESSAGE,
				e.getCause().getMessage());
	}
	try {
		PackagedProgram prg = new PackagedProgram(TestEager.class);
		out.runDetached(prg, 1);
		fail(FAIL_MESSAGE);
	} catch (ProgramInvocationException e) {
		assertEquals(
				DetachedJobExecutionResult.DETACHED_MESSAGE + DetachedJobExecutionResult.JOB_RESULT_MESSAGE + DetachedJobExecutionResult.EAGER_FUNCTION_MESSAGE,
				e.getCause().getMessage());
	}
	try {
		PackagedProgram prg = new PackagedProgram(TestGetRuntime.class);
		out.runDetached(prg, 1);
		fail(FAIL_MESSAGE);
	} catch (ProgramInvocationException e) {
		assertEquals(
				DetachedJobExecutionResult.DETACHED_MESSAGE + DetachedJobExecutionResult.JOB_RESULT_MESSAGE,
				e.getCause().getMessage());
	}
	try {
		PackagedProgram prg = new PackagedProgram(TestGetJobID.class);
		out.runDetached(prg, 1);
		fail(FAIL_MESSAGE);
	} catch (ProgramInvocationException e) {
		assertEquals(
				DetachedJobExecutionResult.DETACHED_MESSAGE + DetachedJobExecutionResult.JOB_RESULT_MESSAGE,
				e.getCause().getMessage());
	}
	try {
		PackagedProgram prg = new PackagedProgram(TestGetAccumulator.class);
		out.runDetached(prg, 1);
		fail(FAIL_MESSAGE);
	} catch (ProgramInvocationException e) {
		assertEquals(
				DetachedJobExecutionResult.DETACHED_MESSAGE + DetachedJobExecutionResult.JOB_RESULT_MESSAGE + DetachedJobExecutionResult.EAGER_FUNCTION_MESSAGE,
				e.getCause().getMessage());
	}
	try {
		PackagedProgram prg = new PackagedProgram(TestGetAllAccumulator.class);
		out.runDetached(prg, 1);
		fail(FAIL_MESSAGE);
	} catch (ProgramInvocationException e) {
		assertEquals(
				DetachedJobExecutionResult.DETACHED_MESSAGE + DetachedJobExecutionResult.JOB_RESULT_MESSAGE,
				e.getCause().getMessage());
	}
}