@Override
    public AppResponse process(Flow flow, SessionDataRequest request) throws SharedServiceClientException {

        return validateAmountOfApps(flow, appSession.getAccountId(), request)
            .orElseGet(() -> validateSms(flow, appSession.getAccountId(), request.getSmscode())
                .orElseGet(() -> confirmSession(flow, request)));
    }
@Test
    void processValidateAmountOfAppsValid() throws SharedServiceClientException {
        when(appAuthenticatorService.countByAccountIdAndInstanceIdNot(ACCOUNT_ID, SESSION_DATA_REQUEST_INSTANCE_ID)).thenReturn(3);
        AppAuthenticator authenticator = new AppAuthenticator();
        authenticator.setUserAppId(UUID.randomUUID().toString());
        authenticator.setAccountId(ACCOUNT_ID);
        authenticator.setDeviceName(DEVICE_NAME);
        authenticator.setInstanceId(SESSION_DATA_REQUEST_INSTANCE_ID);
        authenticator.setIssuerType("digid_app");
        authenticator.setSubstantieelActivatedAt(null);

        when(appAuthenticatorService.createAuthenticator(ACCOUNT_ID, DEVICE_NAME, SESSION_DATA_REQUEST_INSTANCE_ID, "digid_app", null, null)).thenReturn(authenticator);

        AppResponse appResponse = sessionConfirmed.process(mockedActivateAppWithOtherAppFlow, mockedSessionDataRequest);

        AppAuthenticator appAuthenticator = sessionConfirmed.getAppAuthenticator();

        assertNotSame(mockedAppAuthenticator, appAuthenticator);
        assertEquals(DEVICE_NAME, appAuthenticator.getDeviceName());
        assertEquals(SESSION_DATA_REQUEST_INSTANCE_ID, appAuthenticator.getInstanceId());
        assertEquals("digid_app", appAuthenticator.getIssuerType());
        assertEquals(VALID_RESPONSE_CODE, ((SessionDataResponse)appResponse).getStatus());
    }