@Test
 public void unsupportedTypeThrowsException() {
   thrown.expect(RuntimeException.class);
   thrown.expectMessage("No workflow definition found for type [nonexistent]");
   WorkflowInstance i = constructWorkflowInstanceBuilder().setType("nonexistent").build();
   preProcessor.process(i);
 }
 @Test
 public void wrongStartStateCausesException() {
   thrown.expect(RuntimeException.class);
   thrown.expectMessage("Specified state [end] is not a start state.");
   WorkflowInstance i =
       constructWorkflowInstanceBuilder().setExternalId("123").setState("end").build();
   preProcessor.process(i);
 }
 @Test
 public void setsStatusToCreatedWhenStatusIsNotSpecified() {
   WorkflowInstance i = constructWorkflowInstanceBuilder().setStatus(null).build();
   WorkflowInstance processed = preProcessor.process(i);
   assertThat(processed.status, is(WorkflowInstance.WorkflowInstanceStatus.created));
 }
 @Test
 public void createsMissingState() {
   WorkflowInstance i = constructWorkflowInstanceBuilder().build();
   WorkflowInstance processed = preProcessor.process(i);
   assertThat(processed.state, is("CreateLoan"));
 }
 @Test
 public void createsMissingExternalId() {
   WorkflowInstance i = constructWorkflowInstanceBuilder().build();
   WorkflowInstance processed = preProcessor.process(i);
   assertThat(processed.externalId, notNullValue());
 }