public void testReviewBooking_Confirm() { setCurrentState("reviewBooking"); getFlowScope().put("booking", createTestBooking()); MockExternalContext context = new MockExternalContext(); context.setEventId("confirm"); resumeFlow(context); assertFlowExecutionEnded(); assertFlowExecutionOutcomeEquals("bookingConfirmed"); }
public void testEnterBookingDetails_Proceed() { setCurrentState("enterBookingDetails"); getFlowScope().put("booking", createTestBooking()); MockExternalContext context = new MockExternalContext(); context.setEventId("proceed"); resumeFlow(context); assertCurrentStateEquals("reviewBooking"); assertResponseWrittenEquals("reviewBooking", context); }
public void testStartBookingFlow() { Booking booking = createTestBooking(); EasyMock.expect(bookingService.createBooking(1L, "keith")).andReturn(booking); EasyMock.replay(bookingService); MutableAttributeMap input = new LocalAttributeMap(); input.put("hotelId", "1"); MockExternalContext context = new MockExternalContext(); context.setCurrentUser("keith"); startFlow(input, context); assertCurrentStateEquals("enterBookingDetails"); assertResponseWrittenEquals("enterBookingDetails", context); assertTrue(getRequiredFlowAttribute("booking") instanceof Booking); EasyMock.verify(bookingService); }
@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); }