Skip to content

Conversation

@dvacca-onfido
Copy link
Collaborator

Summary

Updates all test files to support the new request builder pattern introduced by the useSingleRequestParameter OpenAPI Generator option.

Background

The Java client has been regenerated with useSingleRequestParameter: true to prevent breaking changes when adding optional parameters to API methods. This requires updating all API method calls to use the new builder pattern with .execute().

Changes

Pattern Transformation

All API method calls now follow this pattern:

Before:

Applicant applicant = onfido.findApplicant(applicantId);
List<WorkflowRun> runs = onfido.listWorkflowRuns(applicantId, status, page, perPage);

After:

Applicant applicant = onfido.findApplicant(applicantId).execute();
List<WorkflowRun> runs = onfido.listWorkflowRuns()
    .applicantId(applicantId)
    .status(status)
    .page(page)
    .perPage(perPage)
    .execute();

Modified Files (22 files)

  • TestBase.java: Updated 11 helper methods including:

    • createApplicant(), uploadDocument(), uploadLivePhoto(), uploadIdPhoto()
    • createCheck(), createWorkflowRun(), cleanUpApplicants(), cleanUpWebhooks()
    • Reflection-based helpers: repeatRequestUntilStatusChanges(), repeatRequestUntilTaskOutputChanges(), repeatRequestUntilHttpCodeChanges()
  • Integration Test Files: Updated all API calls in 21 test classes:

    • OnfidoTest.java
    • AddressTest.java, AdvancedElectronicSignatureTest.java, ApplicantTest.java
    • CheckTest.java, DocumentTest.java, ExtractionTest.java
    • IdPhotoTest.java, LivePhotoTest.java, LiveVideoTest.java
    • MotionCaptureTest.java, PingTest.java, QualifiedElectronicSignatureTest.java
    • ReportTest.java, SdkTokenTest.java, SigningDocumentTest.java
    • TasksTest.java, WatchlistMonitorTest.java, WebhookTest.java
    • WorkflowRunOutputsTest.java, WorkflowRunTest.java

Key Technical Changes

  1. Added .execute() calls to all API method invocations
  2. Updated methods with multiple parameters to use fluent builder pattern
  3. Fixed reflection-based test helpers to call .execute() on request objects before accessing results
  4. Updated assertions to work with the new return types (e.g., ChecksList.getChecks())

No functional changes to test logic - only API invocation pattern updated.

Migration Impact

This change supports the backward-compatible API pattern. Once merged, future additions of optional parameters will not require test updates.

Documentation

  • Updated MIGRATION.md with 6.x to 7.x upgrade guide explaining the new request builder pattern

Related PRs

Update all test files to use the new request builder pattern with .execute() calls.
This change supports the useSingleRequestParameter OpenAPI Generator option which
prevents breaking changes when adding optional parameters to API methods.

Key changes:
- Updated TestBase helper methods to call .execute() on API request objects
- Fixed reflection-based helpers (repeatRequestUntilStatusChanges, etc.)
- Updated all integration test files to use the new pattern
- Modified API calls from direct invocation to builder pattern with .execute()

Example:
- Before: onfido.findApplicant(id)
- After: onfido.findApplicant(id).execute()

All 107 tests passing.
Add migration section documenting the transition from 6.x to 7.x, explaining
the new request builder pattern with .execute() calls and fluent API for
optional parameters.

This pattern change prevents future breaking changes when new optional
parameters are added to API methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants