Senesh Perera created FINERACT-2945:
---------------------------------------

             Summary: Resolve [unchecked] compilation warnings in fineract-loan 
tests (LoanChargeServiceTaxTest, LoanTransactionDataTest)
                 Key: FINERACT-2945
                 URL: https://issues.apache.org/jira/browse/FINERACT-2945
             Project: Apache Fineract
          Issue Type: Improvement
            Reporter: Senesh Perera


Part of the ongoing effort to reduce compiler warnings across the codebase (see 
FINERACT-959 and FINERACT-1790).

While compiling test classes in the fineract-loan module (./gradlew 
:fineract-loan:compileTestJava --rerun-tasks), 11 [unchecked] compiler warnings 
are reported across two test files:

1. org.apache.fineract.portfolio.loanaccount.service.LoanChargeServiceTaxTest:
- Warning: warning: [unchecked] unchecked generic array creation for varargs 
parameter of type Map<TaxComponent,BigDecimal>[] (lines 212-213)
- Fix: Replace the varargs .thenReturn(map1, map2) call with equivalent chained 
.thenReturn(map1).thenReturn(map2) stubbing.

2. org.apache.fineract.portfolio.loanaccount.data.LoanTransactionDataTest:
- Warning: 10 instances of warning: [unchecked] unchecked conversion caused by 
raw mock(List.class) and mock(Collection.class) calls assigned to parameterized 
variables (lines 92-97, 251, 281, 283, 309).
- Fix: Replace raw mock(List.class) and mock(Collection.class) calls with 
Mockito's type-inferred mock(), updating the local variable declaration on 
lines 95-97 from Collection<...> to List<...> so the runtime mock type remains 
100% identical without needing @SuppressWarnings.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to