Saifulhuq01 commented on code in PR #5668:
URL: https://github.com/apache/fineract/pull/5668#discussion_r2970841723
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ClientHelper.java:
##########
@@ -111,6 +114,58 @@ public static PostClientsResponse createClient(final
PostClientsRequest request)
return
Calls.ok(FineractClientHelper.getFineractClient().clients.createClient(request));
}
+ public static PostClientsResponse addClientAsPerson(final String officeId,
final Long legalFormId, final String externalId) {
+ PostClientsRequest request = new
PostClientsRequest().officeId(officeId != null ? Long.parseLong(officeId) : 1L)
+
.legalFormId(legalFormId).firstname(Utils.randomFirstNameGenerator()).lastname(Utils.randomLastNameGenerator())
+
.externalId(externalId).dateFormat(Utils.DATE_FORMAT).locale("en").active(true).activationDate(DEFAULT_DATE);
+ return createClient(request);
+ }
+
+ public static GetClientsClientIdResponse getClientByExternalId(final
String externalId) {
+ return
Calls.ok(FineractClientHelper.getFineractClient().clients.retrieveOneClientByExternalId(externalId,
null));
+ }
+
+ public static PutClientsClientIdResponse updateClientByExternalId(final
String externalId, final PutClientsClientIdRequest request) {
+ return
Calls.ok(FineractClientHelper.getFineractClient().clients.updateClientByExternalId(externalId,
request));
+ }
+
+ public static DeleteClientsClientIdResponse deleteClientByExternalId(final
String externalId) {
+ return
Calls.ok(FineractClientHelper.getFineractClient().clients.deleteClientByExternalId(externalId));
+ }
+
+ public static GetClientsClientIdAccountsResponse getClientAccounts(final
String externalId) {
+ return
Calls.ok(FineractClientHelper.getFineractClient().clients.retrieveAllClientAccountsByExternalId(externalId));
+ }
+
+ public static GetClientTransferProposalDateResponse
getProposedTransferDate(final String externalId) {
+ return
Calls.ok(FineractClientHelper.getFineractClient().clients.retrieveClientTransferTemplateByExternalId(externalId));
+ }
+
+ // public static List<GetObligeeData> getObligeeData(final String
externalId) {
+ // GetClientObligeeDetailsResponse response = Calls
+ //
.ok(FineractClientHelper.getFineractClient().clients.retrieveClientObligeeDetailsByExternalId(externalId));
+ // return response != null && response.getObligees() != null ? new
ArrayList<>(response.getObligees()) : new ArrayList<>();
+ // }
+
Review Comment:
Hi @Dpk376 , good catch on identifying the OpenAPI schema mismatch.
However, committing commented-out/dead code blocks generally goes against
clean code guidelines. More importantly, falling back to RestAssured here
circumvents the primary objective of this migration epic.
Instead of introducing a workaround and leaving technical debt in the test
layer, the standard approach would be to fix the root cause: correcting the
OpenAPI response schema (likely by updating the @ApiResponses annotation in the
respective API Controller). Once the controller correctly defines the return
type as an array, the Feign client will regenerate the correct
List<GetObligeeData> mapping, allowing us to completely remove the RestAssured
dependency without workarounds.
Should we address the Controller annotation in this PR to keep the migration
clean?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]