Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def "CreateOtp success with empty signers"() {
- given:
- def view = new OtpRequestView(id: "1")
- def customerId = "99018921"
- def loanId = "234CLAAAZN3412112"
- def userId = 12321
- def prepaymentSigners = new HashSet<PrepaymentSignersEntity>()
- def prepaymentEntity = new PrepaymentEntity(
- id: 1,
- userId: userId,
- customerId: customerId,
- contractNumber: loanId,
- altContactNumber: "K01/23",
- amount: BigDecimal.valueOf(50),
- prepaymentStatus: PrepaymentStatus.CREATED,
- createdAt: LocalDateTime.of(2019, 10, 10, 11, 10, 9),
- debitAccount: "asdfhshf",
- prepaymentSigners: prepaymentSigners
- )
- def otpResponse = new OtpCreateResponse(uuid: "adhash1234hahs")
- when:
- def result = prepaymentService.createOtp(view, customerId, userId)
- then:
- 1 * prepaymentRepository.findByIdAndCustomerId(1, customerId) >> Optional.of(prepaymentEntity)
- 1 * permissionClient.canSign(customerId, userId, prepaymentEntity.getDebitAccount(),
- Collections.emptyList()) >> true
- 1 * otpClient.createOtp(prepaymentEntity.getUserId(), prepaymentEntity.getCustomerId()) >> otpResponse
- 1 * prepaymentSignersRepository.save(_ as PrepaymentSignersEntity) >> {
- args ->
- def buildEntity = args.get(0)
- buildEntity.getUserId() == prepaymentEntity.getUserId()
- buildEntity.getSignStatus() == SignerStatus.CREATED
- buildEntity.getOtpUuid() == otpResponse.getUuid()
- buildEntity.getPrepayment() == prepaymentEntity
- }
- result != null
- result.getUuid() == otpResponse.getUuid()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement