FINERACT-2421: Refractor redundant and some deprecated code as per new Java 21 style (Phase 3)
This commit is contained in:
+6
-7
@@ -21,7 +21,6 @@ package org.apache.fineract.investor.service;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -29,9 +28,9 @@ import static org.mockito.Mockito.when;
|
||||
import com.google.gson.JsonElement;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
@@ -107,7 +106,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest {
|
||||
|
||||
// then
|
||||
verify(testContext.loanProductRepository).existsById(testContext.loanProductId);
|
||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(eq(command.entityId()));
|
||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(command.entityId());
|
||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).saveAndFlush(loanProductAttributeArgumentCaptor.capture());
|
||||
}
|
||||
|
||||
@@ -134,7 +133,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest {
|
||||
|
||||
// then
|
||||
verify(testContext.loanProductRepository).existsById(testContext.loanProductId);
|
||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(eq(command.entityId()));
|
||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(command.entityId());
|
||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository, times(0))
|
||||
.saveAndFlush(loanProductAttributeArgumentCaptor.capture());
|
||||
}
|
||||
@@ -157,7 +156,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest {
|
||||
|
||||
// then
|
||||
verify(testContext.loanProductRepository).existsById(testContext.loanProductId);
|
||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(eq(1L));
|
||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(1L);
|
||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository, times(0))
|
||||
.saveAndFlush(loanProductAttributeArgumentCaptor.capture());
|
||||
Assertions.assertEquals(thrownException.getMessage(), "Loan product attribute with id " + 1L + " was not found");
|
||||
@@ -188,7 +187,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest {
|
||||
|
||||
// then
|
||||
verify(testContext.loanProductRepository).existsById(testContext.loanProductId);
|
||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(eq(command.entityId()));
|
||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(command.entityId());
|
||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository, times(0))
|
||||
.saveAndFlush(loanProductAttributeArgumentCaptor.capture());
|
||||
Assertions.assertEquals(thrownException.getMessage(),
|
||||
@@ -365,7 +364,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest {
|
||||
private ExternalAssetOwnerLoanProductAttributesWriteServiceImpl externalAssetOwnerLoanProductAttributesWriteService;
|
||||
|
||||
private final FromJsonHelper fromJsonHelper = new FromJsonHelper();
|
||||
private final Long loanProductId = Long.valueOf(RandomStringUtils.randomNumeric(2));
|
||||
private final Long loanProductId = ThreadLocalRandom.current().nextLong(10, 100);
|
||||
@Setter
|
||||
private String attributeKey = "SETTLEMENT_MODEL";
|
||||
@Setter
|
||||
|
||||
Reference in New Issue
Block a user