Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. def "CreateOtp success with empty signers"() {
  2. given:
  3. def view = new OtpRequestView(id: "1")
  4. def customerId = "99018921"
  5. def loanId = "234CLAAAZN3412112"
  6. def userId = 12321
  7.  
  8. def prepaymentSigners = new HashSet<PrepaymentSignersEntity>()
  9. def prepaymentEntity = new PrepaymentEntity(
  10. id: 1,
  11. userId: userId,
  12. customerId: customerId,
  13. contractNumber: loanId,
  14. altContactNumber: "K01/23",
  15. amount: BigDecimal.valueOf(50),
  16. prepaymentStatus: PrepaymentStatus.CREATED,
  17. createdAt: LocalDateTime.of(2019, 10, 10, 11, 10, 9),
  18. debitAccount: "asdfhshf",
  19. prepaymentSigners: prepaymentSigners
  20. )
  21.  
  22. def otpResponse = new OtpCreateResponse(uuid: "adhash1234hahs")
  23.  
  24. when:
  25. def result = prepaymentService.createOtp(view, customerId, userId)
  26.  
  27. then:
  28. 1 * prepaymentRepository.findByIdAndCustomerId(1, customerId) >> Optional.of(prepaymentEntity)
  29. 1 * permissionClient.canSign(customerId, userId, prepaymentEntity.getDebitAccount(),
  30. Collections.emptyList()) >> true
  31. 1 * otpClient.createOtp(prepaymentEntity.getUserId(), prepaymentEntity.getCustomerId()) >> otpResponse
  32. 1 * prepaymentSignersRepository.save(_ as PrepaymentSignersEntity) >> {
  33. args ->
  34. def buildEntity = args.get(0)
  35. buildEntity.getUserId() == prepaymentEntity.getUserId()
  36. buildEntity.getSignStatus() == SignerStatus.CREATED
  37. buildEntity.getOtpUuid() == otpResponse.getUuid()
  38. buildEntity.getPrepayment() == prepaymentEntity
  39. }
  40. result != null
  41. result.getUuid() == otpResponse.getUuid()
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement