Generation

testsSat, 25 Feb 2023

public List<BusEmployeeEntity> getEmployees(Long destinationAccountId, Function<BusTransferRequestEntity, String> getEmployeeIds) throws Exception { Optional<BusTransferRequestEntity> optionalAccount = transferRequestRepository.findById(destinationAccountId); if(!optionalAccount.isPresent()){ throw new DataNotFoundException("destinationAccount '" + destinationAccountId + "' doesn't exist"); } BusTransferRequestEntity account = optionalAccount.get(); String employeeIds = getEmployeeIds.apply(account); if(employeeIds == null){ return null; } return StringUtils.getIdsIntoJsonString(employeeIds).stream() .map(employeeId -> employeeRepository.findById(employeeId).orElseThrow(RuntimeException::new)) .filter(Objects::nonNull).collect(Collectors.toList()); }

Maven dependencies:

Questions about programming?Chat with your personal AI assistant