Skip to content

Commit

Permalink
Add unit tests for previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownNPC committed Aug 28, 2019
1 parent 9bd1e53 commit ff75ba0
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
@@ -1,5 +1,6 @@
package com.github.unknownnpc.psw.p24.serializer

import com.github.unknownnpc.psw.api.ExternalAPIPayloadParseException
import com.github.unknownnpc.psw.p24.model._
import org.apache.http.util.EntityUtils
import org.scalatest.{FunSpec, Matchers}
Expand Down Expand Up @@ -91,4 +92,9 @@ class CardBalanceReqResSerializerTest extends FunSpec with Matchers {
result.data.card.src shouldBe "M"
}

it("should return error when response is invalid") {
val result = P24Serializer.cardBalanceReqResSerializer.fromRes("asdasda").left.get
result shouldBe a[ExternalAPIPayloadParseException]
}

}
@@ -1,5 +1,6 @@
package com.github.unknownnpc.psw.p24.serializer

import com.github.unknownnpc.psw.api.ExternalAPIPayloadParseException
import com.github.unknownnpc.psw.p24.model._
import org.apache.http.util.EntityUtils
import org.scalatest.{FunSpec, Matchers}
Expand Down Expand Up @@ -104,4 +105,9 @@ class WalletHistoryReqResSerializerTest extends FunSpec with Matchers {
result.data.info.statements should have size 3
}

it("should return error when response is invalid") {
val result = P24Serializer.walletHistoryReqResSerializer.fromRes("asdasda").left.get
result shouldBe a[ExternalAPIPayloadParseException]
}

}
@@ -1,5 +1,6 @@
package com.github.unknownnpc.psw.qiwi.serializer

import com.github.unknownnpc.psw.api.ExternalAPIPayloadParseException
import com.github.unknownnpc.psw.qiwi.model.AccountBalanceRequest
import org.scalatest.{FunSpec, Matchers}

Expand Down Expand Up @@ -61,4 +62,9 @@ class AccountBalanceReqResSerializerTest extends FunSpec with Matchers {
response.accounts.head.defaultAccount shouldBe true
}

it("should return error when response is invalid") {
val result = QiwiSerializer.accountBalanceReqResSerializer.fromRes("asdasda").left.get
result shouldBe a[ExternalAPIPayloadParseException]
}

}
Expand Up @@ -2,6 +2,7 @@ package com.github.unknownnpc.psw.qiwi.serializer

import java.util.Date

import com.github.unknownnpc.psw.api.ExternalAPIPayloadParseException
import com.github.unknownnpc.psw.qiwi.model.{ReqSources, ReqTransferType, ResStatus, WalletHistoryRequest}
import org.scalatest.{FunSpec, Matchers}

Expand Down Expand Up @@ -132,4 +133,9 @@ class WalletHistoryReqResSerializerTest extends FunSpec with Matchers {
response.nextTxnId shouldBe None
}

it("should return error when response is invalid") {
val result = QiwiSerializer.walletHistoryReqResSerializer.fromRes("asdasda").left.get
result shouldBe a[ExternalAPIPayloadParseException]
}

}
Expand Up @@ -2,6 +2,7 @@ package com.github.unknownnpc.psw.wm.serializer

import java.util.Date

import com.github.unknownnpc.psw.api.ExternalAPIPayloadParseException
import com.github.unknownnpc.psw.wm.Utils.WMDateFormatter
import com.github.unknownnpc.psw.wm.model.{RetVal, X3Request, X3RequestOperation, X3ResponseOperationType}
import org.apache.http.util.EntityUtils
Expand Down Expand Up @@ -88,4 +89,9 @@ class X3ReqResSerializerTest extends FunSpec with Matchers {
result.operations.details.head.props(X3ResponseOperationType.rest) shouldBe "14"
}

it("should return error when response is invalid") {
val result = WebMoneySerializer.x3ReqResSerializer.fromRes("asdasda").left.get
result shouldBe a[ExternalAPIPayloadParseException]
}

}
Expand Up @@ -2,6 +2,7 @@ package com.github.unknownnpc.psw.wm.serializer

import java.util.Date

import com.github.unknownnpc.psw.api.ExternalAPIPayloadParseException
import com.github.unknownnpc.psw.wm.model.{RetVal, X9Request}
import org.apache.http.util.EntityUtils
import org.scalatest.{FunSpec, Matchers}
Expand Down Expand Up @@ -63,4 +64,9 @@ class X9ReqResSerializerTest extends FunSpec with Matchers {
result.purses.details.head.lastouttr shouldBe "6"
}

it("should return error when response is invalid") {
val result = WebMoneySerializer.x9ReqResSerializer.fromRes("asdasda").left.get
result shouldBe a[ExternalAPIPayloadParseException]
}

}

0 comments on commit ff75ba0

Please sign in to comment.