@Test public void testStart() throws Exception { MockExternalContext context = new MockExternalContext(); when(hospitalManager.findAll()).thenReturn(new ArrayList<>()); PersonObjectModel person = createMockPerson(); MutableAttributeMap input = new LocalAttributeMap<>(); input.put("person", person); startFlow(input, context); assertFlowExecutionActive(); assertCurrentStateEquals(ENTER_PERSON_INFO); }
@Test public void testEnterIdentityCard() throws Exception { MockExternalContext context = new MockExternalContext(); when(hospitalManager.findAll()).thenReturn(new ArrayList<>()); when(personService.isNewPerson(any(PersonObjectModel.class))).thenReturn(true); PersonObjectModel person = createMockPerson(); MutableAttributeMap input = new LocalAttributeMap<>(); input.put("person", person); startFlow(input, context); assertFlowExecutionActive(); assertCurrentStateEquals(ENTER_PERSON_INFO); context.setEventId("next"); resumeFlow(context); assertFlowExecutionActive(); assertCurrentStateEquals(ENTER_IC_INFO); }
@ModelAttribute private List<Hospital> getHospitals() { return hospitalManager.findAll(); }