Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 2.56 KB | None | 0 0
  1.   "A Transaction Service" should "return newly inserted transaction by id" in {
  2.     for {
  3.       r <- RetailerServiceTest.write(retailer) recover { case _ => insertError("retailer") }
  4.       l <- LenderServiceTest.insert(lender) recover { case _ => insertError("lender") }
  5.       transactionCopy = transaction.copy(retailer = transaction.retailer.copy(sid = r.sid), lenderSID = l.sid)
  6.       t <- insert(transactionCopy) recover { case _ => insertError("transaction") }
  7.       newTransaction <- findById(t.sfhTransactionId) getOrElse
  8.         fail("Should return newly inserted transaction by id")
  9.     } {
  10.       import org.joda.time.format.DateTimeFormat
  11.  
  12.       val dateFmt = DateTimeFormat.forPattern("MM-dd-yyyy")
  13.       val timeFmt = DateTimeFormat.forPattern("HH:mm:ss")
  14.  
  15.       newTransaction.retailerLocationId should be (transaction.retailerLocationId)
  16.       newTransaction.terminalId should be (transaction.terminalId)
  17.       newTransaction.retailerFileReferenceId should be (transaction.retailerFileReferenceId)
  18.       newTransaction.settlementBatchId should be (transaction.settlementBatchId)
  19.       newTransaction.sfhTransactionId should not be (transaction.sfhTransactionId)
  20.       newTransaction.primaryAccountNumber should be (transaction.primaryAccountNumber)
  21.       newTransaction.cardExpirationDate should be (transaction.cardExpirationDate)
  22.       newTransaction.nclReferenceId should be (transaction.nclReferenceId)
  23.       newTransaction.transactionAmount should be (transaction.transactionAmount)
  24.       newTransaction.sfhCTransactionType should be (transaction.sfhCTransactionType)
  25.       newTransaction.transactionDate.map(dateFmt.print(_)) should be (transaction.transactionDate.map(dateFmt.print(_)))
  26.       newTransaction.transactionTime.map(timeFmt.print(_)) should be (transaction.transactionTime.map(timeFmt.print(_)))
  27.       newTransaction.transactionDBADesc should be (transaction.transactionDBADesc)
  28.       newTransaction.retailerTransactionId should be (transaction.retailerTransactionId)
  29.       newTransaction.retailerTransactionDesc should be (transaction.retailerTransactionDesc)
  30.       newTransaction.retailer.sid should be (r.sid)
  31.       newTransaction.lenderSID should be (l.sid)
  32.       newTransaction.authorizationId should be (transaction.authorizationId)
  33.       newTransaction.promotionalCode should be (transaction.promotionalCode)
  34.       newTransaction.sfhRMTransactionId should be (transaction.sfhRMTransactionId)
  35.       newTransaction.settlementStatus should be (transaction.settlementStatus)
  36.       newTransaction.currentFlag should be (transaction.currentFlag)
  37.     }
  38.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement