FINERACT-1971: Fixing Loan COB error on startup when Loan COB is disabled

This commit is contained in:
Peter Bagrij
2024-03-22 12:16:40 +01:00
committed by Adam Saghy
parent c34f2b4f59
commit c404f474e9
6 changed files with 16 additions and 40 deletions
@@ -32,7 +32,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.mock.env.MockEnvironment;
@ExtendWith(MockitoExtension.class)
class LoanCOBManagerConditionTest {
class BatchManagerConditionTest {
@Mock
private ConditionContext conditionContext;
@@ -43,7 +43,7 @@ class LoanCOBManagerConditionTest {
private MockEnvironment environment;
@InjectMocks
private LoanCOBManagerCondition testObj = new LoanCOBManagerCondition();
private BatchManagerCondition testObj = new BatchManagerCondition();
@BeforeEach
public void setUp() {
@@ -52,24 +52,14 @@ class LoanCOBManagerConditionTest {
}
@Test
public void testMatchesShouldReturnFalseWhenLoanCobIsDisabledAndManager() {
environment.withProperty("fineract.job.loan-cob-enabled", "false");
environment.withProperty("fineract.mode.batch-manager-enabled", "true");
boolean result = testObj.matches(conditionContext, metadata);
assertThat(result).isFalse();
}
@Test
public void testMatchesShouldReturnFalseWhenLoanCobIsEnabledAndNotManager() {
environment.withProperty("fineract.job.loan-cob-enabled", "true");
public void testMatchesShouldReturnFalseWhenManagerDisabled() {
environment.withProperty("fineract.mode.batch-manager-enabled", "false");
boolean result = testObj.matches(conditionContext, metadata);
assertThat(result).isFalse();
}
@Test
public void testMatchesShouldReturnTrueWhenLoanCobIsEnabledAndManager() {
environment.withProperty("fineract.job.loan-cob-enabled", "true");
public void testMatchesShouldReturnTrueWhenManagerEnabled() {
environment.withProperty("fineract.mode.batch-manager-enabled", "true");
boolean result = testObj.matches(conditionContext, metadata);
assertThat(result).isTrue();
@@ -32,7 +32,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.mock.env.MockEnvironment;
@ExtendWith(MockitoExtension.class)
class LoanCOBWorkerConditionTest {
class BatchWorkerConditionTest {
@Mock
private ConditionContext conditionContext;
@@ -43,7 +43,7 @@ class LoanCOBWorkerConditionTest {
private MockEnvironment environment;
@InjectMocks
private LoanCOBWorkerCondition testObj = new LoanCOBWorkerCondition();
private BatchWorkerCondition testObj = new BatchWorkerCondition();
@BeforeEach
public void setUp() {
@@ -52,24 +52,14 @@ class LoanCOBWorkerConditionTest {
}
@Test
public void testMatchesShouldReturnFalseWhenLoanCobIsDisabledAndWorker() {
environment.withProperty("fineract.job.loan-cob-enabled", "false");
environment.withProperty("fineract.mode.batch-worker-enabled", "true");
boolean result = testObj.matches(conditionContext, metadata);
assertThat(result).isFalse();
}
@Test
public void testMatchesShouldReturnFalseWhenLoanCobIsEnabledAndNotWorker() {
environment.withProperty("fineract.job.loan-cob-enabled", "true");
public void testMatchesShouldReturnFalseWhenWorkerDisabled() {
environment.withProperty("fineract.mode.batch-worker-enabled", "false");
boolean result = testObj.matches(conditionContext, metadata);
assertThat(result).isFalse();
}
@Test
public void testMatchesShouldReturnTrueWhenLoanCobIsEnabledAndWorker() {
environment.withProperty("fineract.job.loan-cob-enabled", "true");
public void testMatchesShouldReturnTrueWhenWorkerEnabled() {
environment.withProperty("fineract.mode.batch-worker-enabled", "true");
boolean result = testObj.matches(conditionContext, metadata);
assertThat(result).isTrue();