[OBPIH-6666] unit tests on generating prepayment invoice#4828
Merged
ewaterman merged 2 commits intofeature/OBPIH-6398-partial-invoices-for-prepaid-pofrom Sep 5, 2024
Conversation
kchelstowski
reviewed
Sep 5, 2024
| private List<InvoiceItem> getInvoiceItemsOnOrderItems(Invoice invoice) { | ||
| return invoice.invoiceItems.stream() | ||
| .filter {ii -> ii.orderItems != null && !ii.orderItems.isEmpty()} | ||
| .collect(Collectors.toList()) |
Collaborator
There was a problem hiding this comment.
it's Java's approach for such operations, but in groovy you can just do:
invoice.invoiceItems.findAll { it.ordersItems != null && !it.orderItems.isEmpty() }btw. I assume this can't be null, because it's 1:N association that is by default an empty set.
Member
Author
There was a problem hiding this comment.
You're right. Even better would be to rely on groovy truth:
invoice.invoiceItems.findAll{ it.orderItems }
alannadolny
approved these changes
Sep 5, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✨ Description of Change
Link to GitHub issue or Jira ticket: https://pihemr.atlassian.net/browse/OBPIH-6666
Description: Add unit tests on PrepaymentInvoiceService.generatePrepaymentInvoice. We'll ideally also write tests on the other methods in the service but this can be a starting point.
📈 Test Plan
Description of test plan (if applicable):
✅ Quality Checks
[OBS-123]for Jira,[#0000]for GitHub, or[OBS-123, OBPIH-123]if there are multiple), or with[N/A]if not applicable