specs2

    1热度

    1回答

    我有两个模拟对象,我用它来创建一个Guice测试模块。 我有两个问题: 我需要每次测试之前创建的模拟对象,如果我验证模拟的互动呢?我想是的,为了实现它,我想我需要使用“之前”的块。 如何创建以下DRY原则的每个测试吉斯测试模块:)(即如何使用同一个代码块的每个测试) 这是代码我有这么远 class SampleServiceTest extends Specification with Mocki

    1热度

    1回答

    XmlMatchers非常强大,但我无法将它用作参数匹配器。我如何修改匹配器不能用于Seq [Node]? trait Connector { def send(envelope: Node):Elem } 收件与scalatest了测试,使用和的Mockito xmlMatchers性状: import org.scalatest.junit.AssertionsFo

    -1热度

    1回答

    执行的错误,我有以下的测试代码: import org.specs2.mutable.Specification import org.specs2.specification.{BeforeExample, Before, Scope} class TestSpec extends Specification with BeforeExample { def before =

    2热度

    2回答

    我正在使用specs2与Scala Play(2.3)的集成测试,我使用MySQL数据库进行测试,而不是一个H2数据库。我的测试用例使用WithApplication和FakeApplication配置覆盖db.default.url来指定测试(mysql)数据库。 问题是没有进行任何演变。由于没有创建表格,因此测试用例全部被弹出。 如果我正常运行应用程序,而不是在测试下,然后应用演变,然后转储此

    1热度

    1回答

    Scala代码: class Sender { def send(objects: Any): Unit =() } class User(sender: Sender) { def hello(): Unit = { sender.send("hello") sender.send(1) sender.send(2) } }

    1热度

    1回答

    我正在运行使用第三方库的scalacheck测试。该库打印很多std.err我正在检查的属性。我只能在测试执行期间如何抑制这种噪音? 我试着重定向std.err在规范本身,但这没有效果。 def aFailureScenario = prop { input: Input => System.setErr(new PrintStream(new ByteArrayOutputStream

    1热度

    1回答

    我必须测试一个无循环图并总是检查字符串是否不同不是非常有用(它会引发异常)。必须有更好的解决方案,但我无法想出它,而且我在specs2文档中迷失了方向。 这是代码的示例: "BiDirectionalEdge" should { "throw an Error for the wrong DirectedEdges" in prop { (a :String, b :String, c

    1热度

    1回答

    的方法说我有一类和相关的隐含类: class Project implicit class RichProject(p:Project) { def searchFile(keyword:String):Seq[File] = { p.getFiles.filter(_.name.contains(keyword)) } } 然后我想嘲笑为project的se

    2热度

    3回答

    我有以下特点 trait MyTrait{ def printHelloWorld(){ println("hello world") } } case object SayHello class MyActor extends Actor with MyTrait{ def recieve = { case SayHello =

    0热度

    1回答

    我有看起来像这样的代码来检测赋值中的NPE。分配触发该NPE发生的隐式转换(它含蓄地从CoreRecommendedDomain到APIRecommededDomain转换: "ensure Scala RecommendedDomain from null must throw NPE" in { val n: CoreRecommendedDomain = null var