TaskRegistry { public AbstractTask retrieveTask(String taskIdentifier) { final Executable task = this.executableRegistry.getTask(taskIdentifier); return new LocalJvmTask(task); } @Inject  TaskRegistry(@ManagedEnv ExecutableRegistry executableRegistry); void registerTask(AbstractTask task, EventData[] events); List<AbstractHook> getPreExecHooks(Task task); List<AbstractHook> getPostExecHooks(Task task); void registerPreExecHooks(AbstractTask task, List<AbstractHook> hooks); void registerPostExecHooks(AbstractTask task, List<AbstractHook> hooks); static String getEventsKey(EventData[] events); AbstractTask retrieveTask(String taskIdentifier);  }
@Test public void testRetrieve_shouldReturnTaskGivenIdentifier() throws Exception { final Object someObject = new Object(); final Executable givenExecutable = new ExecutableImpl(someObject, someObject.getClass().getDeclaredMethod("toString"), 10); when(executableRegistry.getTask(anyString())).thenReturn(givenExecutable); assertThat(taskRegistry.retrieveTask("com.flipkart.flux.impl.SomeWorkflow_simpleStringModifyingTask_java.lang.String_java.lang.String")).isEqualTo(new LocalJvmTask(givenExecutable)); verify(executableRegistry, times(1)).getTask("com.flipkart.flux.impl.SomeWorkflow_simpleStringModifyingTask_java.lang.String_java.lang.String"); }
@Test(expected = UnknownIdentifierException.class) public void testRetrieve_shouldBombIfTaskCannotBeFound() throws Exception { when(executableRegistry.getTask(anyString())).thenThrow(new UnknownIdentifierException("blah")); taskRegistry.retrieveTask("com.flipkart.flux.impl.SomeWorkflow_simpleStringModifyingTask_java.lang.String_java.lang.String"); }