@Test
public void testManagedTask_Callable_ManagedTask() {

    final String RESULT = "result";
    ManagedTaskListenerImpl TASK_LISTENER = new ManagedTaskListenerImpl();
    Map<String, String> EXEC_PROPERTIES = new HashMap<String, String>();
    EXEC_PROPERTIES.put("custom", "true");
    EXEC_PROPERTIES.put(ManagedTask.LONGRUNNING_HINT, "false");
    final String TASK_DESCRIPTION = "task1 description";
    ManagedTaskCallableImpl<String> task = new ManagedTaskCallableImpl(RESULT, TASK_DESCRIPTION, EXEC_PROPERTIES, TASK_LISTENER);
    ManagedTaskListenerImpl taskListener = new ManagedTaskListenerImpl();
    Map<String, String> executionProperties = new HashMap<String, String>();
    final String TASK_NAME = "task1";
    executionProperties.put(ManagedTask.IDENTITY_NAME, TASK_NAME);
    executionProperties.put(ManagedTask.LONGRUNNING_HINT, "true");
    
    Callable<String> wrapped = ManagedExecutors.managedTask(task, executionProperties, taskListener);
    ManagedTask managedTask = (ManagedTask) wrapped;
    assertTrue(taskListener == managedTask.getManagedTaskListener());
    assertEquals("true", managedTask.getExecutionProperties().get(ManagedTask.LONGRUNNING_HINT));
    assertEquals(TASK_NAME, managedTask.getExecutionProperties().get(ManagedTask.IDENTITY_NAME));
    assertEquals("true", managedTask.getExecutionProperties().get("custom"));
}