@Test public void load() { WorkflowContext context = new WorkflowServiceFactory().createWorkflowContext(); context.defineVariable(NAME, VALUE); Type actual = NodeLoaderHelper.load(context, Type.class); assertThat(actual.value).isSameAs(VALUE); }
@Test public void loadWithAdaper() { final Runnable parameter = mock(Runnable.class); WorkflowContext context = new WorkflowServiceFactory().createWorkflowContext(); context.defineVariable(NAME, VALUE); TypeWithConstructor actual = NodeLoaderHelper.load( context, new LoadAdapter<TypeWithConstructor>() { @Override public TypeWithConstructor load() { return new TypeWithConstructor(parameter); } }); assertThat(actual.value).isSameAs(VALUE); assertThat(actual.runnable).isSameAs(parameter); }