use of org.folio.service.finance.expenceclass.ExpenseClassValidationService in project mod-orders by folio-org.
the class ExpenseClassValidationServiceTest method testShouldNotThrowDuplicateKeyException.
@Test
@DisplayName("Should not throw DuplicateKeyException")
void testShouldNotThrowDuplicateKeyException() {
CompositePoLine compositePoLine = getMockAsJson(COMP_PO_LINES_MOCK_DATA_PATH, ANOTHER_PO_LINE_ID_FOR_SUCCESS_CASE).mapTo(CompositePoLine.class);
compositePoLine.getFundDistribution().clear();
var fd = new FundDistribution().withFundId(UUID.randomUUID().toString()).withCode("ANY").withExpenseClassId(UUID.randomUUID().toString()).withDistributionType(FundDistribution.DistributionType.PERCENTAGE).withValue(100D);
compositePoLine.getFundDistribution().add(fd);
List<CompositePoLine> compositePoLineList = new ArrayList<>();
compositePoLineList.add(compositePoLine);
compositePoLineList.add(compositePoLine);
ExpenseClassValidationService expenseClassValidationService = mock(ExpenseClassValidationService.class, CALLS_REAL_METHODS);
RequestContext requestContext = new RequestContext(null, null);
doReturn(completedFuture(null)).when(expenseClassValidationService).checkExpenseClassIsActiveByFundDistribution(any(), anyBoolean(), any());
CompletableFuture<Void> response = expenseClassValidationService.validateExpenseClasses(compositePoLineList, true, requestContext);
response.join();
Assertions.assertTrue(response.isDone());
}
Aggregations