rhopman commented on PR #5166:
URL: https://github.com/apache/fineract/pull/5166#issuecomment-3568093469

   Implementation looks good to me. I would recommend adding a test in 
`SearchResourcesTest.java`, something like this:
   
   ```java
       @Test
       public void searchSavingsAndSharesHaveEntityStatus() {
           // Create client
           String jsonPayload = 
ClientHelper.getBasicClientAsJSON(ClientHelper.DEFAULT_OFFICE_ID, 
ClientHelper.LEGALFORM_ID_PERSON, null);
           final PostClientsResponse clientResponse = 
ClientHelper.addClientAsPerson(requestSpec, responseSpec, jsonPayload);
           final Long clientId = clientResponse.getClientId();
           final GetClientsClientIdResponse getClientResponse = 
ClientHelper.getClient(requestSpec, responseSpec, clientId.intValue());
   
           // Search for savings accounts - should return results with proper 
entityStatus
           final List<String> savingsResources = Arrays.asList("savings");
           final ArrayList<GetSearchResponse> savingsSearchResponse = 
SearchHelper.getSearch(requestSpec, responseSpec,
                   getClientResponse.getAccountNo(), Boolean.FALSE, 
getResources(savingsResources));
           
           // Verify that if any SAVING entities are returned, they have valid 
entityStatus
           savingsSearchResponse.stream()
                   .filter(result -> 
"SAVING".equalsIgnoreCase(result.getEntityType()))
                   .forEach(result -> {
                       assertNotNull(result.getEntityStatus(), "SAVING entity 
should have entityStatus");
                       assertNotNull(result.getEntityStatus().getId(), "SAVING 
entityStatus should have id");
                       assertNotNull(result.getEntityStatus().getCode(), 
"SAVING entityStatus should have code");
                   });
   
           // Search for share accounts - should return results with proper 
entityStatus
           final List<String> shareResources = Arrays.asList("shares");
           final ArrayList<GetSearchResponse> shareSearchResponse = 
SearchHelper.getSearch(requestSpec, responseSpec,
                   getClientResponse.getAccountNo(), Boolean.FALSE, 
getResources(shareResources));
           
           // Verify that if any SHARE entities are returned, they have valid 
entityStatus
           shareSearchResponse.stream()
                   .filter(result -> 
"SHARE".equalsIgnoreCase(result.getEntityType()))
                   .forEach(result -> {
                       assertNotNull(result.getEntityStatus(), "SHARE entity 
should have entityStatus");
                       assertNotNull(result.getEntityStatus().getId(), "SHARE 
entityStatus should have id");
                       assertNotNull(result.getEntityStatus().getCode(), "SHARE 
entityStatus should have code");
                   });
       }
   ```


-- 
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]

Reply via email to