LocalContext { public void registerNewState(Long version, String name, String description, String hookIdentifier, String taskIdentifier, Long retryCount, Long timeout, List<EventDefinition> dependencySet, EventDefinition outputEvent ) { final StateDefinition stateDefinition = new StateDefinition(version, name, description, hookIdentifier, taskIdentifier, hookIdentifier, retryCount, timeout, dependencySet, outputEvent); this.stateMachineDefinition.get().addState(stateDefinition); } LocalContext();   LocalContext(ThreadLocal<StateMachineDefinition> stateMachineDefinition, ThreadLocal<MutableInt> tlUniqueEventCount, ThreadLocal<IdentityHashMap<Event, String>> eventNames); void registerNew(String workflowIdentifier, long version, String description,String correlationId,
                            String clientElbId); void registerNewState(Long version,
                                 String name, String description,
                                 String hookIdentifier, String taskIdentifier,
                                 Long retryCount, Long timeout,
                                 List<EventDefinition> dependencySet, EventDefinition outputEvent
    ); void reset(); StateMachineDefinition getStateMachineDef(); boolean isWorkflowInterception(); void addEvents(EventData ...events); String generateEventName(Event event); EventDefinition checkExistingDefinition(final EventDefinition givenDefinition);  }
@Test public void testRegisterNewState() throws Exception { localContext.registerNew("fooBar", 1, "someDescription",null, "defaultElbId"); EventDefinition dummyDependency = new EventDefinition("someName","com.blah.some.Event"); EventDefinition dummyOutput = new EventDefinition("someOutput","com.blah.some.Event"); localContext.registerNewState(1l, "someState", null, "com.blah.some.Hook", "com.blah.some.Task", 1l, 1000l, Collections.singletonList(dummyDependency), dummyOutput); StateDefinition expectedStateDefinition = new StateDefinition(1l,"someState",null, "com.blah.some.Hook", "com.blah.some.Task", "com.blah.some.Hook", 1l, 1000l, Collections.singletonList(dummyDependency), dummyOutput); assertThat(tlStateMachineDef.get()).isEqualTo(new StateMachineDefinition("someDescription", "fooBar", 1l, Collections.singleton(expectedStateDefinition), new HashSet<>(), null, "defaultElbId")); }