FINERACT-2267: Use the proper not-null annotation in Fineract code base
This commit is contained in:
committed by
Adam Saghy
parent
8d7d8ca7ef
commit
d71c0bd204
+2
-2
@@ -27,7 +27,7 @@ import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.loanaccount.data.LoanTermVariationsData;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanCharge;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
@Getter
|
||||
public class ChangeOperation implements Comparable<ChangeOperation> {
|
||||
@@ -116,7 +116,7 @@ public class ChangeOperation implements Comparable<ChangeOperation> {
|
||||
|
||||
@Override
|
||||
@SuppressFBWarnings(value = "EQ_COMPARETO_USE_OBJECT_EQUALS", justification = "TODO: fix this! See: https://stackoverflow.com/questions/2609037/findbugs-how-to-solve-eq-compareto-use-object-equals")
|
||||
public int compareTo(@NotNull ChangeOperation o) {
|
||||
public int compareTo(@NonNull ChangeOperation o) {
|
||||
int datePortion = DateUtils.compareWithNullsLast(this.getEffectiveDate(), o.getEffectiveDate());
|
||||
if (datePortion == 0) {
|
||||
final boolean isAccrual = isAccrualActivity();
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ package org.apache.fineract.portfolio.loanproduct.calc.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
public record InterestRate(//
|
||||
LocalDate effectiveFrom, //
|
||||
@@ -28,7 +28,7 @@ public record InterestRate(//
|
||||
) implements Comparable<InterestRate> {
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull InterestRate o) {
|
||||
public int compareTo(@NonNull InterestRate o) {
|
||||
return this.effectiveFrom().compareTo(o.effectiveFrom());
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import java.util.Map;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@@ -79,7 +79,7 @@ public class AdvancedPaymentAllocationsJsonParser {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private List<PaymentAllocationType> getPaymentAllocationTypes(JsonArray paymentAllocationOrder) {
|
||||
if (paymentAllocationOrder != null) {
|
||||
List<Pair<Integer, PaymentAllocationType>> parsedListWithOrder = paymentAllocationOrder.asList().stream().map(json -> {
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import java.util.Map;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@@ -67,7 +67,7 @@ public class CreditAllocationsJsonParser {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private List<AllocationType> getAllocationTypes(JsonArray allocationOrder) {
|
||||
if (allocationOrder != null) {
|
||||
List<Pair<Integer, AllocationType>> parsedListWithOrder = allocationOrder.asList().stream().map(json -> {
|
||||
|
||||
+2
-2
@@ -82,7 +82,6 @@ import org.apache.fineract.portfolio.loanproduct.domain.CreditAllocationTransact
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRelatedDetail;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationTransactionType;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
@@ -94,6 +93,7 @@ import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.MockedStatic;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class AdvancedPaymentScheduleTransactionProcessorTest {
|
||||
@@ -524,7 +524,7 @@ class AdvancedPaymentScheduleTransactionProcessorTest {
|
||||
return installment;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private LoanCreditAllocationRule createMockCreditAllocationRule(AllocationType... allocationTypes) {
|
||||
LoanCreditAllocationRule mockCreditAllocationRule = mock(LoanCreditAllocationRule.class);
|
||||
lenient().when(mockCreditAllocationRule.getTransactionType()).thenReturn(CreditAllocationTransactionType.CHARGEBACK);
|
||||
|
||||
+2
-2
@@ -43,7 +43,6 @@ import org.apache.fineract.portfolio.loanproduct.calc.data.PeriodDueDetails;
|
||||
import org.apache.fineract.portfolio.loanproduct.calc.data.ProgressiveLoanInterestScheduleModel;
|
||||
import org.apache.fineract.portfolio.loanproduct.calc.data.RepaymentPeriod;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductMinimumRepaymentScheduleRelatedDetail;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
@@ -55,6 +54,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.MockedStatic;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class ProgressiveEMICalculatorTest {
|
||||
@@ -3195,7 +3195,7 @@ class ProgressiveEMICalculatorTest {
|
||||
zeroAmount, zeroAmount, false, mc);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private static LoanRepaymentScheduleInstallment createPeriod(int periodId, LocalDate start, LocalDate end) {
|
||||
LoanRepaymentScheduleInstallment period = Mockito.mock(LoanRepaymentScheduleInstallment.class);
|
||||
Mockito.when(period.getInstallmentNumber()).thenReturn(periodId);
|
||||
|
||||
+2
-2
@@ -37,7 +37,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
@@ -45,6 +44,7 @@ import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class AdvancedPaymentAllocationsJsonParserTest {
|
||||
@@ -225,7 +225,7 @@ class AdvancedPaymentAllocationsJsonParserTest {
|
||||
return list;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private JsonCommand createJsonCommand(Map<String, Object> jsonMap) throws JsonProcessingException {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String json = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonMap);
|
||||
|
||||
+6
-6
@@ -30,10 +30,10 @@ import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.function.Executable;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
class AdvancedPaymentAllocationsValidatorTest {
|
||||
|
||||
@@ -164,7 +164,7 @@ class AdvancedPaymentAllocationsValidatorTest {
|
||||
assertPlatformException(message, code, validationException);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private static LoanProductPaymentAllocationRule createLoanProductAllocationRule1() {
|
||||
LoanProductPaymentAllocationRule lppr1 = new LoanProductPaymentAllocationRule();
|
||||
lppr1.setTransactionType(DEFAULT);
|
||||
@@ -173,7 +173,7 @@ class AdvancedPaymentAllocationsValidatorTest {
|
||||
return lppr1;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private static LoanProductPaymentAllocationRule createLoanProductAllocationRule2() {
|
||||
LoanProductPaymentAllocationRule lppr2 = new LoanProductPaymentAllocationRule();
|
||||
lppr2.setTransactionType(REPAYMENT);
|
||||
@@ -184,7 +184,7 @@ class AdvancedPaymentAllocationsValidatorTest {
|
||||
return lppr2;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private static LoanProductPaymentAllocationRule createLoanProductAllocationRule3() {
|
||||
LoanProductPaymentAllocationRule lppr = new LoanProductPaymentAllocationRule();
|
||||
lppr.setTransactionType(REPAYMENT);
|
||||
@@ -197,7 +197,7 @@ class AdvancedPaymentAllocationsValidatorTest {
|
||||
return lppr;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private static LoanProductPaymentAllocationRule createLoanProductAllocationRule4() {
|
||||
LoanProductPaymentAllocationRule lppr = new LoanProductPaymentAllocationRule();
|
||||
lppr.setTransactionType(DEFAULT);
|
||||
@@ -211,7 +211,7 @@ class AdvancedPaymentAllocationsValidatorTest {
|
||||
return lppr;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private static List<Pair<Integer, PaymentAllocationType>> createPaymentAllocationTypeList() {
|
||||
return EnumSet.allOf(PaymentAllocationType.class).stream().map(p -> {
|
||||
try {
|
||||
|
||||
+2
-2
@@ -33,7 +33,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
@@ -41,6 +40,7 @@ import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class CreditAllocationsJsonParserTest {
|
||||
@@ -113,7 +113,7 @@ public class CreditAllocationsJsonParserTest {
|
||||
return map;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private JsonCommand createJsonCommand(Map<String, Object> jsonMap) throws JsonProcessingException {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String json = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonMap);
|
||||
|
||||
+3
-3
@@ -28,10 +28,10 @@ import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.function.Executable;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
public class CreditAllocationsValidatorTest {
|
||||
|
||||
@@ -104,13 +104,13 @@ public class CreditAllocationsValidatorTest {
|
||||
ADVANCED_PAYMENT_ALLOCATION_STRATEGY));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private static List<Pair<Integer, AllocationType>> createCreditAllocationTypeList() {
|
||||
AtomicInteger i = new AtomicInteger(1);
|
||||
return EnumSet.allOf(AllocationType.class).stream().map(p -> Pair.of(i.getAndIncrement(), p)).toList();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
private static LoanProductCreditAllocationRule createLoanProductCreditAllocationRule1() {
|
||||
LoanProductCreditAllocationRule lpcr1 = new LoanProductCreditAllocationRule();
|
||||
lpcr1.setTransactionType(CHARGEBACK);
|
||||
|
||||
Reference in New Issue
Block a user