14.5. Testing flow startup

Have your first test exercise the startup of your flow:

public void testStartBookingFlow() {

    Booking booking = createTestBooking();

    MutableAttributeMap input = new LocalAttributeMap();
    input.put("hotelId", "1");
    MockExternalContext context = new MockExternalContext();
    context.setCurrentUser("keith");
    startFlow(input, context);

    assertCurrentStateEquals("enterBookingDetails");
    assertTrue(getRequiredFlowAttribute("booking") instanceof Booking);
}
        

Assertions generally verify the flow is in the correct state you expect.