如何使用jUnit在Scala中测试rest端点

如何使用jUnit在Scala中测试rest端点,scala,rest,junit,Scala,Rest,Junit,我的Scala服务中有rest post端点。我想使用集成测试jUnit来测试它们。我正在寻找一些教程,但我只找到使用play或其他框架的示例。。。我只想使用jUnit。你有没有举出一些例子 class ExampleIntegrationJUnitStyleSpec extends JUnitSuite with Matchers { @Test def shouldRespondWithPublicResource(): Unit = { //test post endpo

我的Scala服务中有rest post端点。我想使用集成测试jUnit来测试它们。我正在寻找一些教程,但我只找到使用play或其他框架的示例。。。我只想使用jUnit。你有没有举出一些例子

class ExampleIntegrationJUnitStyleSpec extends JUnitSuite with Matchers {

  @Test def shouldRespondWithPublicResource(): Unit = {


    //test post endpoint

  }
}

object ExampleIntegrationJUnitStyleSpec {

  private lazy val _myAppRule = new JUnitMyAppRule("integration", 8811)

  @ClassRule
  def myAppRule: JUnitMyAppRule = _myAppRule
}

您可以使用Specs2和分派库()测试REST API。

您可以使用Specs2和分派库()测试REST API。

好的,但我只想使用jUnit和ScalaTest。这是可能的?我认为这应该是可能的,因为无论如何,Web服务消费者不需要使用与其生产者相同的语言。因此,在最坏的情况下,您可能需要编写Java(而不是Scala)代码来测试itOk,但我只想使用jUnit和ScalaTest。这是可能的?我认为这应该是可能的,因为无论如何,Web服务消费者不需要使用与其生产者相同的语言。因此,在最坏的情况下,您可能需要编写Java(而不是Scala)代码来测试它