14

いくつかの ScalaTest マッチャーを使用して Scala テストを作成しています。

私のテストが失敗すると、intellijは次のように言います

{"count":3,"pagination":{"offset":0,"limit":100},"content":{"uri":"http://locahost.com/catalogue/content?order=Query&id=18,20,19"},"list":[{"id":"18","position":27},{"id":"20","position":341},{"id":"19","position":33}]} was not equal to {"count":3,"pagination":{"offset":0,"limit":100},"content":{"uri":"http://locahost.com/catalogue/content?order=Query&id=18,20,19"},"list":[{"id":"18","timestamp":"2015-01-28T11:55:44.494Z","content":"Episode","position":27},{"id":"20","timestamp":"2015-01-19T11:55:44.494Z","content":"Program","position":341},{"id":"19","timestamp":"2015-01-17T11:55:44.494Z","content":"Episode","position":33}]}
org.scalatest.exceptions.TestFailedException: {"count":3,"pagination":{"offset":0,"limit":100},"content":{"uri":"http://locahost.com/catalogue/content?order=Query&id=18,20,19"},"list":[{"id":"18","position":27},{"id":"20","position":341},{"id":"19","position":33}]} was not equal to {"count":3,"pagination":{"offset":0,"limit":100},"content":{"uri":"http://locahost.com/catalogue/content?order=Query&id=18,20,19"},"list":[{"id":"18","timestamp":"2015-01-28T11:55:44.494Z","content":"Episode","position":27},{"id":"20","timestamp":"2015-01-19T11:55:44.494Z","content":"Program","position":341},{"id":"19","timestamp":"2015-01-17T11:55:44.494Z","content":"Episode","position":33}]}
at    org.scalatest.MatchersHelper$.newTestFailedException(MatchersHelper.scala:160)
at org.scalatest.Matchers$ShouldMethodHelper$.shouldMatcher(Matchers.scala:6231)
at org.scalatest.Matchers$AnyShouldWrapper.should(Matchers.scala:6265)
...

ただし、intellij では、テキスト機能の便利な違いを確認することはできません。

2つのオブジェクトを比較しているためだと思いました

  val responseBody = responseAs[JsValue]
  responseBody should be(viewingByAccountIdResponseJson)

しかし、それを

assert(responseBody.toString() === viewingByAccountIdResponseJson.toString())

テキスト比較もできません。

これを行うために intellij を構成する方法はありますか?

(私は現在、Matchers で FlatSpec を使用しています)

注: これは 、Intellij Idea が 2 つのテキストの差分を表示するように出力をフォーマットするというこの質問に関連しています。

ただし、intellij が推奨する可能性のある構文を使用しても、機能しません。

4

3 に答える 3

5

これは現時点では不可能であり、現時点では機能のリクエストです。

https://youtrack.jetbrains.com/issue/SCL-4867

于 2015-03-06T10:42:45.200 に答える