title: How to create a StateMachine from a StateMachineConfigurer
body: <p>I have an annotation based state machine configuration:</p>
  
  <pre><code>@Component @Scope(BeanDefinition.SCOPE_PROTOTYPE)
  @EnableStateMachine(name = "machine1")
  public class Machine1 extends
     EnumStateMachineConfigurerAdapter&lt;SimStates, SimEvents&gt; {
  
     @Override
     public void configure(StateMachineStateConfigurer&lt;SimStates, SimEvents&gt; states) throws Exception {
        states.withStates()
          .initial(INIT)
          .state(INIT)
          .state(S1)
          .state(FINISH)
          .end(FINISH)
        ;
      }
    ...
  </code></pre>
  
  <p>Now I want to create Tests for it. I would prefer not have an implicit call to <code>getBean("machine1")</code>" via <code>StateMachineFactory.getStateMachine("machine1")</code>, which would require an application context.</p>
  
  <p>I'd rather instantiate <code>Machine1</code> and feed it to some Builder, Configurator or Adapter to get a <code>StateMachine&lt;&gt;</code> instance. </p>
  
  <pre><code>public class Machine1Test {
  
    @Test
    public void testMachine1() throws Exception {
  
      final StateMachineConfigurer&lt;SimStates, SimEvents&gt; smc = 
        new Machine1();
  
  
      final StateMachineBuilder.Builder&lt;SimStates, SimEvents&gt; builder = 
          StateMachineBuilder.builder();
  
      // can I use the builder together with smc? Or something else?
  
      StateMachine&lt;SimStates,SimEvents&gt; sm = ... // how?
    }
  }
  </code></pre>
  
  <p><em>Update:</em> I updated "without full application context" to  "without an implicit call to <code>getBean("machine1")</code>". The question is also about understanding about all the factories, adapters, configurations and configurators of spring state machine.</p>