ifs-data-layer/ifs-data-service/src/test/java/org/innovateuk/ifs/project/projectdetails/workflow/ProjectDetailsWorkflowHandlerIntegrationTest.java
/**
     * Test that adding one of the mandatory values (when other mandatory values are not yet filled in) keeps the
     * state in pending
     */
Test that adding one of the mandatory values (when other mandatory values are not yet filled in) keeps the
state in pending
Test that adding one of the mandatory values ( when other mandatory values are not yet filled in ) keeps the state in pending
private void assertAddMandatoryValue(BiFunction<Project, ProjectUser, Boolean> handlerMethod, ProjectDetailsEvent expectedEvent) {
        Project project = newProject().build();
        ProjectUser projectUser = newProjectUser().build();
        ProjectDetailsProcess pendingProcess = new ProjectDetailsProcess(projectUser, project, ProjectDetailsState.PENDING);
        when(projectDetailsProcessRepositoryMock.findOneByTargetId(project.getId())).thenReturn(pendingProcess);
        assertTrue(handlerMethod.apply(project, projectUser));
        verify(projectDetailsProcessRepositoryMock, atLeastOnce()).findOneByTargetId(project.getId());
        verify(projectDetailsProcessRepositoryMock).save(
                processExpectations(project.getId(), projectUser.getId(), ProjectDetailsState.PENDING, expectedEvent));
        verifyNoMoreInteractionsWithMocks();
    }
private void assertAddMandatoryValue ( BiFunction < Project , ProjectUser , Boolean > handlerMethod , ProjectDetailsEvent expectedEvent ) { Project project = newProject ( ) . build ( ) ; ProjectUser projectUser = newProjectUser ( ) . build ( ) ; ProjectDetailsProcess pendingProcess = new ProjectDetailsProcess ( projectUser , project , ProjectDetailsState . PENDING ) ; when ( projectDetailsProcessRepositoryMock . findOneByTargetId ( project . getId ( ) ) ) . thenReturn ( pendingProcess ) ; assertTrue ( handlerMethod . apply ( project , projectUser ) ) ; verify ( projectDetailsProcessRepositoryMock , atLeastOnce ( ) ) . findOneByTargetId ( project . getId ( ) ) ; verify ( projectDetailsProcessRepositoryMock ) . save ( processExpectations ( project . getId ( ) , projectUser . getId ( ) , ProjectDetailsState . PENDING , expectedEvent ) ) ; verifyNoMoreInteractionsWithMocks ( ) ; }
Test that adding one of the mandatory values (when other mandatory values are not yet filled in) keeps the
 state in pending
Test that adding one of the mandatory values ( when other mandatory values are not yet filled in ) keeps the state in pending
// now call the method under test