• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Scala Scope类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Scala中org.specs2.specification.Scope的典型用法代码示例。如果您正苦于以下问题:Scala Scope类的具体用法?Scala Scope怎么用?Scala Scope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Scope类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Scala代码示例。

示例1: JsonLeumiCardMerchantParserTest

//设置package包名称以及导入依赖的类
package com.wix.pay.leumicard

import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope

class JsonLeumiCardMerchantParserTest extends SpecWithJUnit {

  "stringify and then parse" should {
    "yield a merchant similar to the original one" in new Context {
      val someMerchant = LeumiCardMerchant(masof = "012345678")

      val merchantKey = merchantParser.stringify(someMerchant)

      merchantParser.parse(merchantKey) must beEqualTo(someMerchant)
    }
  }

  trait Context extends Scope {
    val merchantParser: LeumiCardMerchantParser = new JsonLeumiCardMerchantParser
  }
} 
开发者ID:wix,项目名称:libpay-leumicard,代码行数:22,代码来源:JsonLeumiCardMerchantParserTest.scala


示例2: JsonLeumiCardAuthorizationParserTest

//设置package包名称以及导入依赖的类
package com.wix.pay.leumicard

import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope

class JsonLeumiCardAuthorizationParserTest extends SpecWithJUnit {
  trait Ctx extends Scope {
    val authorizationParser: LeumiCardAuthorizationParser = new JsonLeumiCardAuthorizationParser
  }

  "stringify and then parse" should {
    "yield an authorization similar to the original one" in new Ctx {
      val someAuthorization = LeumiCardAuthorization(
        transactionId = "0123456"
      )

      val authorizationKey = authorizationParser.stringify(someAuthorization)
      authorizationParser.parse(authorizationKey) must beEqualTo(someAuthorization)
    }
  }
} 
开发者ID:wix,项目名称:libpay-leumicard,代码行数:22,代码来源:JsonLeumiCardAuthorizationParserTest.scala


示例3: ResponseParserTest

//设置package包名称以及导入依赖的类
package com.wix.sms.nexmo.model

import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope

class ResponseParserTest extends SpecWithJUnit {
  trait Ctx extends Scope {
    val someResponse = Response(
      `message-count` = "1",
      messages = Seq(Message(
        status = Statuses.success,
        to = Some("some to")
      ))
    )

    val parser = new ResponseParser
  }

  "stringify and then parse" should {
    "yield an object similar to the original one" in new Ctx {
      val json = parser.stringify(someResponse)
      parser.parse(json) must beEqualTo(someResponse)
    }
  }
} 
开发者ID:wix,项目名称:libsms-nexmo,代码行数:26,代码来源:ResponseParserTest.scala


示例4: PaginatedResponseRetrieverSpec

//设置package包名称以及导入依赖的类
package com.dwolla.awssdk.utils

import com.amazonaws.services.ecs.AmazonECSAsync
import com.amazonaws.services.ecs.model.{ListClustersRequest, ListClustersResult, ListContainerInstancesRequest, ListContainerInstancesResult}
import com.dwolla.awssdk.AmazonAsyncMockingImplicits._
import com.dwolla.awssdk.utils.PaginatedResponseRetriever._
import org.specs2.concurrent.ExecutionEnv
import org.specs2.mock.Mockito
import org.specs2.mutable.Specification
import org.specs2.specification.Scope

import scala.collection.JavaConverters._

class PaginatedResponseRetrieverSpec(implicit ee: ExecutionEnv) extends Specification with Mockito {

  trait Setup extends Scope {
    val mockEcsClient = mock[AmazonECSAsync]
  }

  "PaginatedResponseRetriever" should {
    "make all the requests necessary to fetch all paginated results" in new Setup {
      def reqWithNextToken(x: Option[Int]) = new ListContainerInstancesRequest().withCluster("cluster1").withNextToken(x.map(i ? s"next-token-$i").orNull)

      def res(x: Int, y: Option[Int] = None) = Right(new ListContainerInstancesResult().withContainerInstanceArns(s"arn$x").withNextToken(y.map(i ? s"next-token-$i").orNull))

      val pages = 1 to 50
      val pairs = pages.sliding(2).toSeq.map {
        case Vector(1, y) ? reqWithNextToken(None) ? res(1, Option(y))
        case Vector(x, y) if x > 1 && y < pages.last ? reqWithNextToken(Option(x)) ? res(x, Option(y))
        case Vector(x, _) ? reqWithNextToken(Option(x)) ? res(x, None)
      }

      mockedMethod(mockEcsClient.listContainerInstancesAsync) answers (pairs: _*)

      val output = fetchAll(() ? new ListContainerInstancesRequest().withCluster("cluster1"),mockEcsClient.listContainerInstancesAsync)
        .map(_.flatMap(_.getContainerInstanceArns.asScala.toList))

      output must containTheSameElementsAs(pages.dropRight(1).map(x ? s"arn$x")).await
    }

    "support default request factory" in new Setup {
      new ListClustersResult() completes mockEcsClient.listClustersAsync

      val output = fetchAllWithDefaultRequestsVia(mockEcsClient.listClustersAsync)

      output must contain(new ListClustersResult()).await
    }

    "support builder syntax with factory as initial parameter" in new Setup {
      new ListClustersResult() completes mockEcsClient.listClustersAsync

      val output = fetchAllWithRequestsLike(() ? new ListClustersRequest).via(mockEcsClient.listClustersAsync)

      output must contain(new ListClustersResult()).await
    }
  }
} 
开发者ID:Dwolla,项目名称:scala-aws-utils,代码行数:58,代码来源:PaginatedResponseRetrieverSpec.scala


示例5: PaloParserTest

//设置package包名称以及导入依赖的类
package com.wix.sms.cellact.model

import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope

import scala.collection.JavaConversions._

class PaloParserTest extends SpecWithJUnit {
  trait Ctx extends Scope {
    val parser = new PaloParser
  }

  "stringify and then parse" should {
    val palo = new Palo

    palo.HEAD = new Head
    palo.HEAD.FROM = "some from"
    palo.HEAD.APP = new App
    palo.HEAD.APP.USER = "some user"
    palo.HEAD.APP.PASSWORD = "some password"
    palo.HEAD.CMD = "some cmd"

    palo.BODY = new Body
    palo.BODY.CONTENT = "some content"
    palo.BODY.DEST_LIST = new DestList
    palo.BODY.DEST_LIST.TO = Seq("some to 1", "some to 2")

    palo.OPTIONAL = new Optional
    palo.OPTIONAL.CALLBACK = "some callback"

    "yield an object similar to the original one" in new Ctx {
      val xml = parser.stringify(palo)
      parser.parse(xml) must beEqualTo(palo)
    }
  }
} 
开发者ID:wix,项目名称:libsms-cellact,代码行数:37,代码来源:PaloParserTest.scala


示例6: ResponseParserTest

//设置package包名称以及导入依赖的类
package com.wix.sms.cellact.model

import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope

class ResponseParserTest extends SpecWithJUnit {
  trait Ctx extends Scope {
    val parser = new ResponseParser
  }

  "stringify and then parse" should {
    val response = new Response
    response.BLMJ = "some blmj"
    response.RESULTCODE = "123"
    response.RESULTMESSAGE = "some resultmessage"

    "yield an object similar to the original one" in new Ctx {
      val xml = parser.stringify(response)
      parser.parse(xml) must beEqualTo(response)
    }
  }
} 
开发者ID:wix,项目名称:libsms-cellact,代码行数:23,代码来源:ResponseParserTest.scala


示例7: RSAUtilsTest

//设置package包名称以及导入依赖的类
package com.wix.pay.twocheckout.tokenization

import java.security.spec.RSAPublicKeySpec
import java.security.{KeyFactory, KeyPairGenerator}
import javax.crypto.Cipher

import org.apache.commons.codec.binary.Base64
import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope

class RSAUtilsTest extends SpecWithJUnit {

  "RSAUtils" should {

    "encrypt data with provided key in base64 format" in new Ctx {
      val encrypted = RSAUtils.rsaEncrypt(publicKey, someMessage)
      decryptBase64(encrypted) mustEqual someMessage
    }

    "encrypt empty string with provided key in base64 format" in new Ctx {
      val encrypted = RSAUtils.rsaEncrypt(publicKey, emptyMessage)
      decryptBase64(encrypted) mustEqual emptyMessage
    }
  }

  trait Ctx extends Scope {
    val factory = KeyPairGenerator.getInstance("RSA")
    factory.initialize(2048)

    val keys = factory.genKeyPair()
    val publicKeySpec = KeyFactory.getInstance("RSA").getKeySpec(keys.getPublic, classOf[RSAPublicKeySpec])
    val publicKey = RSAPublicKey(
      Base64.encodeBase64String(publicKeySpec.getModulus.toByteArray),
      Base64.encodeBase64String(publicKeySpec.getPublicExponent.toByteArray)
    )
    println(publicKey)
    val someMessage = "some message hello"
    val emptyMessage = ""

    def decryptBase64(encrypted: String): String = {
      val bytes = Base64.decodeBase64(encrypted)
      val cipher = Cipher.getInstance("RSA/ECB/PKCS1PADDING")
      cipher.init(Cipher.DECRYPT_MODE, keys.getPrivate)
      new String(cipher.doFinal(bytes), "utf-8")
    }
  }

} 
开发者ID:wix,项目名称:libpay-2checkout,代码行数:49,代码来源:RSAUtilsTest.scala


示例8: RealTwocheckoutTokenizerTest

//设置package包名称以及导入依赖的类
package com.wix.pay.twocheckout.tokenizer

import com.wix.pay.PaymentErrorException
import com.wix.pay.creditcard.{CreditCard, CreditCardOptionalFields, YearMonth}
import com.wix.pay.twocheckout.model.{TwocheckoutEnvironment, TwocheckoutSettings}
import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope

class RealTwocheckoutTokenizerTest extends SpecWithJUnit {
  skipAll

  "HttpTwocheckoutTokenizer" should {
    "obtain token on valid credentials" in new Ctx {
      tokenizer.tokenize(sellerId, publishableKey, testCreditCard, true) must beSuccessfulTry[String]
    }

    "fail on invalid credentials" in new Ctx {
      tokenizer.tokenize(wrongSellerId, publishableKey, testCreditCard, true) must beFailedTry(beAnInstanceOf[PaymentErrorException])
    }
  }

  trait Ctx extends Scope {
    val settings = TwocheckoutSettings(
      production = TwocheckoutEnvironment("https://www.2checkout.com", "https://www.2checkout.com/checkout/api/2co.min.js"),
      sandbox = TwocheckoutEnvironment("https://sandbox.2checkout.com", "https://sandbox.2checkout.com/checkout/api/2co.min.js")
    )
    val tokenizer = new HttpTwocheckoutTokenizer(settings)

    
    val sellerId = "901338726"
    val publishableKey = "19CFABDB-BA94-45B8-935A-E3A1B2469F1F"

    val wrongSellerId = "11111111"

    val testCreditCard = CreditCard("4000000000000002", YearMonth(2019, 1),
      Some(CreditCardOptionalFields.withFields(csc = Some("471"), holderName = Some("John Doe"))))
  }
} 
开发者ID:wix,项目名称:libpay-2checkout,代码行数:39,代码来源:RealTwocheckoutTokenizerTest.scala


示例9: JsonTwocheckoutMerchantParserTest

//设置package包名称以及导入依赖的类
package com.wix.pay.twocheckout


import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope


class JsonTwocheckoutMerchantParserTest extends SpecWithJUnit {
  trait Ctx extends Scope {
    val parser: TwocheckoutMerchantParser = JsonTwocheckoutMerchantParser
  }

  "stringify and then parse" should {
    "yield a merchant similar to the original one" in new Ctx {
      val someMerchant = TwocheckoutMerchant(
        sellerId = "some seller ID",
        publishableKey = "some publishable key",
        privateKey = "some private key",
        sandboxMode = true
      )

      val merchantKey = parser.stringify(someMerchant)
      parser.parse(merchantKey) must beEqualTo(someMerchant)
    }

    "parse credentials without explicit mode" in new Ctx {
      val someMerchantStr = """{"sellerId":"sellerId","publishableKey":"publishableKey","privateKey":"privateKey"}"""
      val someMerchant = TwocheckoutMerchant(
        sellerId = "sellerId",
        publishableKey = "publishableKey",
        privateKey = "privateKey",
        sandboxMode = false
      )

      parser.parse(someMerchantStr) must beEqualTo(someMerchant)
    }
  }
} 
开发者ID:wix,项目名称:libpay-2checkout,代码行数:39,代码来源:JsonTwocheckoutMerchantParserTest.scala


示例10: JsonTwocheckoutAuthorizationParserTest

//设置package包名称以及导入依赖的类
package com.wix.pay.twocheckout


import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope


class JsonTwocheckoutAuthorizationParserTest extends SpecWithJUnit {
  trait Ctx extends Scope {
    val parser: TwocheckoutAuthorizationParser = JsonTwocheckoutAuthorizationParser
  }

  "stringify and then parse" should {
    "yield a merchant similar to the original one" in new Ctx {
      val someAuthorization = TwocheckoutAuthorization()

      val authorizationKey = parser.stringify(someAuthorization)
      parser.parse(authorizationKey) must beEqualTo(someAuthorization)
    }
  }
} 
开发者ID:wix,项目名称:libpay-2checkout,代码行数:22,代码来源:JsonTwocheckoutAuthorizationParserTest.scala


示例11: NetworkBrokerSpec

//设置package包名称以及导入依赖的类
package net.ruippeixotog.scalafbp.runtime

import akka.actor.Props
import akka.testkit.TestProbe
import org.specs2.specification.Scope
import spray.json.DefaultJsonProtocol._

import net.ruippeixotog.akka.testkit.specs2.mutable.AkkaSpecification
import net.ruippeixotog.scalafbp.component.PortDataMarshaller
import net.ruippeixotog.scalafbp.component.core.Repeat

abstract class NetworkBrokerSpec extends AkkaSpecification {

  class SingleNodeGraph extends GraphTemplate {
    val n1 = node[String](1, 1)
  }

  class TwoNodeGraph extends GraphTemplate {
    val n1, n2 = node[String](1, 1)
  }

  class ThreeNodeGraph extends GraphTemplate {
    val n1, n2, n3 = node[String](1, 1)
  }

  class ChainGraph[A: PortDataMarshaller] extends GraphTemplate {
    val inNode = node(Repeat)
    val outNode = node[A](1, 1)
    initial("init") ~> (inNode, "in")
    (inNode, "out") ~> (outNode, 1)
  }

  class TwoToTwoGraph extends GraphTemplate {
    val inNode1, inNode2, outNode1, outNode2 = node[String](1, 1)
    (inNode1, 1) ~> (outNode1, 1) <~ (inNode2, 1)
    (inNode1, 1) ~> (outNode2, 1) <~ (inNode2, 1)
  }

  abstract class BrokerInstance(dynamic: Boolean = false) extends Scope {
    def _graph: GraphTemplate
    def externalProbe: TestProbe = null

    val lifeProbe, outputProbe = TestProbe()
    val broker = system.actorOf(Props(
      new NetworkBroker(_graph, dynamic, outputProbe.ref, Option(externalProbe).map(_.ref))))

    lifeProbe.watch(broker)
  }
} 
开发者ID:ruippeixotog,项目名称:scalafbp,代码行数:50,代码来源:NetworkBrokerSpec.scala


示例12: SmsResponseParserTest

//设置package包名称以及导入依赖的类
package com.wix.sms.twilio.model

import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope

class SmsResponseParserTest extends SpecWithJUnit {
  trait Ctx extends Scope {
    val someSmsResponse = SmsResponse(
      sid = Some("some sid")
    )
  }

  "stringify and then parse" should {
    "yield an object similar to the original one" in new Ctx {
      val json = SmsResponseParser.stringify(someSmsResponse)
      SmsResponseParser.parse(json) must beEqualTo(someSmsResponse)
    }
  }
} 
开发者ID:wix,项目名称:libsms-twilio,代码行数:20,代码来源:SmsResponseParserTest.scala


示例13: HomeControllerSpec

//设置package包名称以及导入依赖的类
package controllers

import models.UsersRepository
import org.specs2.execute.{AsResult, Result}
import org.specs2.mutable.Around
import org.specs2.specification.Scope
import play.api.Application
import play.api.mvc._
import play.api.test.{FakeRequest, PlaySpecification}

class HomeControllerSpec extends PlaySpecification with Results {

  abstract class WithTestApplication extends Around with Scope with TestEnvironment {
    lazy val app: Application = fakeApp
    lazy val controller = new HomeController(knolxControllerComponent)

    override def around[T: AsResult](t: => T): Result = {
      TestHelpers.running(app)(AsResult.effectively(t))
    }
  }

  "HomeController" should {

    "redirect index page to sessions page" in new WithTestApplication {
      val result = controller.index(FakeRequest())

      status(result) must be equalTo SEE_OTHER
    }

  }

} 
开发者ID:knoldus,项目名称:knolx-portal,代码行数:33,代码来源:HomeControllerSpec.scala


示例14: CreditCardMapperTest

//设置package包名称以及导入依赖的类
package com.wix.pay.stripe

import com.wix.pay.creditcard.{CreditCard, CreditCardOptionalFields, PublicCreditCardOptionalFields, YearMonth}
import com.wix.pay.stripe.drivers.StripeMatchers
import org.specs2.mutable.SpecificationWithJUnit
import org.specs2.specification.Scope

class CreditCardMapperTest extends SpecificationWithJUnit with StripeMatchers {
  "CreditCardMapper" should {
    "create params with all relevant fields " in new ctx{
      CreditCardMapper.cardToParams(someCreditCard) must haveFieldParams(expectedFields)
    }

    "return params without address and zip code as they are empty Strings " in new ctx {
      CreditCardMapper.cardToParams(emptyFieldsCreditCard) must not(haveAnyEmptyFields)
    }
  }

  trait ctx extends Scope {
    val holderId: Some[String] = Some("some holder id")
    val holderName: Some[String] = Some("some holder name")
    val billingAddress: Some[String] = Some("some address")
    val billingPostalCode: Some[String] = Some("some postal Code")

    val someCreditCard = CreditCard(
      "4012888818888",
      YearMonth(2020, 12),
      additionalFields = Some(CreditCardOptionalFields.withFields(
        csc = Some("123"),
        holderId = holderId,
        holderName = holderName,
        billingAddress = billingAddress,
        billingPostalCode = billingPostalCode)))

    val emptyFieldsCreditCard = CreditCard(
      "4012888818888",
      YearMonth(2020, 12),
      additionalFields = Some(CreditCardOptionalFields.withFields(
        csc = Some("123"),
        holderId = holderId,
        holderName = holderName,
        billingAddress = Some(""),
        billingPostalCode = Some(""))))

    val expectedFields = PublicCreditCardOptionalFields(holderId, holderName, billingAddress, billingPostalCode)
  }
} 
开发者ID:wix,项目名称:libpay-stripe,代码行数:48,代码来源:CreditCardMapperTest.scala


示例15: StripeAdditionalInfoMapperTest

//设置package包名称以及导入依赖的类
package com.wix.pay.stripe

import com.wix.pay.stripe.drivers.{StripeAdditionalInfoDomain, StripeMatchers}
import org.specs2.matcher.Matchers
import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope


class StripeAdditionalInfoMapperTest extends SpecWithJUnit with Matchers with StripeMatchers {

  trait Ctx extends Scope with StripeAdditionalInfoDomain {
    val mapper = new StripeAdditionalInfoMapper()

  }

  "Stripe additional info mapper" should {
    "map additional Info into a map" in new Ctx {
      val map: MappedParams = mapper.createMap(someCreditCard, someCustomer, someDeal)
      map must {
        containBillingAddress(billingAddress.get) and
          containCustomer(someCustomer.get) and
          containInvoiceId(someInvoiceId.get) and
          containShippingAddress(someShippingAddress.get) and
          containOrderItems(orderItems) and
          containIncludedCharges(includedCharges.get)
      }

    }
  }
} 
开发者ID:wix,项目名称:libpay-stripe,代码行数:31,代码来源:StripeAdditionalInfoMapperTest.scala


示例16: SendMessageRequestParserTest

//设置package包名称以及导入依赖的类
package com.wix.sms.plivo.model

import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope

class SendMessageRequestParserTest extends SpecWithJUnit {
  trait Ctx extends Scope {
    val someSendMessageRequest = SendMessageRequest(
      src = "some src",
      dst = "some dst",
      text = "some text"
    )
  }

  "stringify and then parse" should {
    "yield an object similar to the original one" in new Ctx {
      val json = SendMessageRequestParser.stringify(someSendMessageRequest)
      SendMessageRequestParser.parse(json) must beEqualTo(someSendMessageRequest)
    }
  }
} 
开发者ID:wix,项目名称:libsms-plivo,代码行数:22,代码来源:SendMessageRequestParserTest.scala


示例17: SendMessageResponseParserTest

//设置package包名称以及导入依赖的类
package com.wix.sms.plivo.model

import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope

class SendMessageResponseParserTest extends SpecWithJUnit {
  trait Ctx extends Scope {
    val someSendMessageResponse = SendMessageResponse(
      api_id = "some api id",
      error = Some("some error"),
      message_uuid = Some(Seq("1", "2"))
    )
  }

  "stringify and then parse" should {
    "yield an object similar to the original one" in new Ctx {
      val json = SendMessageResponseParser.stringify(someSendMessageResponse)
      SendMessageResponseParser.parse(json) must beEqualTo(someSendMessageResponse)
    }
  }
} 
开发者ID:wix,项目名称:libsms-plivo,代码行数:22,代码来源:SendMessageResponseParserTest.scala


示例18: before

//设置package包名称以及导入依赖的类
package com.softbrew.specs2kafka

import java.net.ServerSocket
import java.nio.file.Files
import java.util.Properties

import _root_.kafka.server.KafkaConfig
import _root_.kafka.server.KafkaServerStartable
import org.apache.curator.test.TestingServer
import org.specs2.mutable.BeforeAfter
import org.specs2.specification.Scope

trait SimpleKafkaScope extends Scope with BeforeAfter{
  val zkServer = new TestingServer()
  val socket = new ServerSocket(0)
  val port = socket.getLocalPort.toString
  println(s"'port' looks like: $port")
  socket.close()
  val tmpDir = Files.createTempDirectory("kafka-test-logs")

  val serverProps = new Properties()
  serverProps.put("broker.id", port)
  serverProps.put("log.dirs", tmpDir.toAbsolutePath.toString)
  serverProps.put("host.name", "localhost")
  serverProps.put("zookeeper.connect", zkServer.getConnectString)
  serverProps.put("port", port)

  val config = new KafkaConfig(serverProps)
  val kafkaServer = new KafkaServerStartable(config)

  override def before: Unit = {
    kafkaServer.startup()
  }

  override def after: Unit = {
    kafkaServer.shutdown()
    zkServer.close()
    zkServer.stop()
  }

  println("zkServer: " + zkServer.getConnectString)
  println("Kafka broker port: " + port)
} 
开发者ID:ciaran-,项目名称:specs2-kafka,代码行数:44,代码来源:SimpleKafkaScope.scala


示例19: JsonTranzilaAuthorizationParserTest

//设置package包名称以及导入依赖的类
package com.wix.pay.tranzila


import com.wix.pay.tranzila.TranzilaMatchers._
import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope


class JsonTranzilaAuthorizationParserTest extends SpecWithJUnit {
  trait Ctx extends Scope {
    val authorizationParser: TranzilaAuthorizationParser = new JsonTranzilaAuthorizationParser
  }

  "stringify and then parse" should {
    "yield an authorization similar to the original one" in new Ctx {
      val someAuthorization = TranzilaAuthorization(
        index = "some index",
        confirmationCode = "some confirmation code"
      )

      val authorizationKey = authorizationParser.stringify(someAuthorization)
      authorizationParser.parse(authorizationKey) must beAuthorization(
        index = ===(someAuthorization.index),
        confirmationCode = ===(someAuthorization.confirmationCode)
      )
    }
  }
} 
开发者ID:wix,项目名称:libpay-tranzila,代码行数:29,代码来源:JsonTranzilaAuthorizationParserTest.scala


示例20: JsonTranzilaMerchantParserTest

//设置package包名称以及导入依赖的类
package com.wix.pay.tranzila


import com.wix.pay.tranzila.TranzilaMatchers._
import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope


class JsonTranzilaMerchantParserTest extends SpecWithJUnit {
  trait Ctx extends Scope {
    val merchantParser: TranzilaMerchantParser = new JsonTranzilaMerchantParser
  }


  "stringify and then parse" should {
    "yield a merchant similar to the original one" in new Ctx {
      val someMerchant = TranzilaMerchant(
        username = "some username"
      )

      val merchantKey = merchantParser.stringify(someMerchant)
      merchantParser.parse(merchantKey) must beMerchant(
        username = ===(someMerchant.username)
      )
    }
  }
} 
开发者ID:wix,项目名称:libpay-tranzila,代码行数:28,代码来源:JsonTranzilaMerchantParserTest.scala



注:本文中的org.specs2.specification.Scope类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Scala Provider类代码示例发布时间:2022-05-23
下一篇:
Scala CommandProcessorResponse类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap