Skip to content

Commit

Permalink
BpmnUtilsTest
Browse files Browse the repository at this point in the history
  • Loading branch information
ElisKina-dev committed Nov 24, 2023
1 parent 7c1943d commit d2fc964
Showing 1 changed file with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import java.util.Optional;
import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

@QuarkusTest
public class BpmnUtilsTest {
Expand Down Expand Up @@ -47,24 +46,40 @@ public void testGetBpmnBankConfigPK() {
assertEquals(BankConfigUtilityValues.NULL_VALUE.getValue(), bpmnBankConfigPK.getTerminalId());
}

/* @Test
public void testGetBpmnBankConfigPKWhenTemplateIdOrVersionIsNull() {
@Test
public void testGetBpmnBankConfigPKWhenTemplateIdIsNull() {
BpmnAssociationDto bpmnAssociationDto = new BpmnAssociationDto();
String acquirerId = "ACQ123";
BranchConfigs branchConfig = mock(BranchConfigs.class);

when(branchConfig.getBranchDefaultTemplateId()).thenReturn(null);
when(branchConfig.getBranchDefaultTemplateVersion()).thenReturn(null);

Optional<BpmnBankConfigPK> result = BpmnUtils.getBpmnBankConfigPK(bpmnAssociationDto, acquirerId, branchConfig);
Optional<BpmnBankConfigPK> result = BpmnUtils.getBpmnBankConfigPK(bpmnAssociationDto,
acquirerId, branchConfig);

assertFalse(result.isPresent(), "Result should be empty when either templateId or version is null");
assertFalse(result.isPresent(),
"Result should be empty when either templateId or version is null");

verify(branchConfig, times(1)).getBranchDefaultTemplateId();
verify(branchConfig, times(1)).getBranchDefaultTemplateVersion();
verifyNoMoreInteractions(branchConfig);
}

System.out.println("Method invocations: " + Mockito.mockingDetails(branchConfig).printInvocations());
}*/
@Test
public void testGetBpmnBankConfigPKWhenVersionIsNull() {
BpmnAssociationDto bpmnAssociationDto = new BpmnAssociationDto();
String acquirerId = "ACQ123";
BranchConfigs branchConfig = mock(BranchConfigs.class);

when(branchConfig.getBranchDefaultTemplateId()).thenReturn(UUID.randomUUID());
when(branchConfig.getBranchDefaultTemplateVersion()).thenReturn(null);

Optional<BpmnBankConfigPK> result = BpmnUtils.getBpmnBankConfigPK(bpmnAssociationDto,
acquirerId, branchConfig);

assertFalse(result.isPresent(),
"Result should be empty when either templateId or version is null");

verify(branchConfig, times(1)).getBranchDefaultTemplateVersion();
}
}

0 comments on commit d2fc964

Please sign in to comment.