### Question:
LoginProcess { public LoginStage getLoginStage() { boolean isMenuBasedAuthentication = AuthIndexType.LEVEL.equals(loginConfiguration.getIndexType()) || AuthIndexType.COMPOSITE .equals(loginConfiguration.getIndexType()) || AuthIndexType.RESOURCE .equals(loginConfiguration.getIndexType()); if ((isMenuBasedAuthentication && authContext.getRequirements() == null) || !isMenuBasedAuthentication) { authContext.hasMoreRequirements(); } if (AuthContext.Status.IN_PROGRESS.equals(authContext.getStatus())) { return LoginStage.REQUIREMENTS_WAITING; } else { return LoginStage.COMPLETE; } } LoginProcess(LoginAuthenticator loginAuthenticator, LoginConfiguration loginConfiguration,
            AuthenticationContext authContext, CoreServicesWrapper coreServicesWrapper); LoginStage getLoginStage(); Callback[] getCallbacks(); PagePropertiesCallback getPagePropertiesCallback(); LoginProcess next(Callback[] callbacks); boolean isSuccessful(); boolean isFailed(); SSOToken getSSOToken(); String getSuccessURL(); String getFailureURL(); String getOrgDN(); AuthenticationContext getAuthContext(); LoginConfiguration getLoginConfiguration(); void cleanup();  }### Answer:
@Test public void shouldGetLoginStageWhenAuthIndexTypeNotLevelOrComposite() { given(loginConfiguration.getIndexType()).willReturn(AuthIndexType.NONE); given(authContext.getStatus()).willReturn(AuthContext.Status.IN_PROGRESS); LoginStage loginStage = loginProcess.getLoginStage(); verify(authContext).hasMoreRequirements(); assertEquals(loginStage, LoginStage.REQUIREMENTS_WAITING); }
@Test public void shouldGetLoginStageWhenAuthIndexTypeLevelAndRequirementsNotSetYet() { given(loginConfiguration.getIndexType()).willReturn(AuthIndexType.LEVEL); given(authContext.getRequirements()).willReturn(null); given(authContext.getStatus()).willReturn(AuthContext.Status.IN_PROGRESS); LoginStage loginStage = loginProcess.getLoginStage(); verify(authContext).hasMoreRequirements(); assertEquals(loginStage, LoginStage.REQUIREMENTS_WAITING); }
@Test public void shouldGetLoginStageWhenAuthIndexTypeNotCompositeAndRequirementsNotSetYet() { given(loginConfiguration.getIndexType()).willReturn(AuthIndexType.COMPOSITE); given(authContext.getRequirements()).willReturn(null); given(authContext.getStatus()).willReturn(AuthContext.Status.IN_PROGRESS); LoginStage loginStage = loginProcess.getLoginStage(); verify(authContext).hasMoreRequirements(); assertEquals(loginStage, LoginStage.REQUIREMENTS_WAITING); }
@Test public void shouldGetLoginStageWhenAuthIndexTypeLevelAndRequirementsSet() { given(loginConfiguration.getIndexType()).willReturn(AuthIndexType.LEVEL); given(authContext.getRequirements()).willReturn(new Callback[0]); given(authContext.getStatus()).willReturn(AuthContext.Status.IN_PROGRESS); LoginStage loginStage = loginProcess.getLoginStage(); verify(authContext, never()).hasMoreRequirements(); assertEquals(loginStage, LoginStage.REQUIREMENTS_WAITING); }
@Test public void shouldGetLoginStageWhenAuthIndexTypeCompositeAndRequirementsSet() { given(loginConfiguration.getIndexType()).willReturn(AuthIndexType.COMPOSITE); given(authContext.getRequirements()).willReturn(new Callback[0]); given(authContext.getStatus()).willReturn(AuthContext.Status.IN_PROGRESS); LoginStage loginStage = loginProcess.getLoginStage(); verify(authContext, never()).hasMoreRequirements(); assertEquals(loginStage, LoginStage.REQUIREMENTS_WAITING); }
@Test public void shouldGetLoginStageWhenAuthIndexTypeNotLevelOrCompositeAndComplete() { given(loginConfiguration.getIndexType()).willReturn(AuthIndexType.NONE); given(authContext.getStatus()).willReturn(AuthContext.Status.COMPLETED); LoginStage loginStage = loginProcess.getLoginStage(); verify(authContext).hasMoreRequirements(); assertEquals(loginStage, LoginStage.COMPLETE); }