diff options
author | Jakob Odersky <jakob@driver.xyz> | 2017-11-08 18:28:43 -0800 |
---|---|---|
committer | Jakob Odersky <jakob@driver.xyz> | 2017-11-08 18:30:05 -0800 |
commit | 574cda580870d21de506eecf0ac9dd25bdc4be72 (patch) | |
tree | 9c5d7e27ea5c05fa6e12c2ddfc0a1f302b8d9030 /src/test | |
parent | 1a172285403e77658db9d0331a5b7235946b90eb (diff) | |
download | rest-query-0.14.0.tar.gz rest-query-0.14.0.tar.bz2 rest-query-0.14.0.zip |
Upgrade sbt settings and support Scala 2.12v0.14.0
Diffstat (limited to 'src/test')
4 files changed, 4 insertions, 73 deletions
diff --git a/src/test/scala/xyz/driver/pdsuicommon/logging/PhiStringContextSuite.scala b/src/test/scala/xyz/driver/pdsuicommon/logging/PhiStringContextSuite.scala index eb9d9b4..8fd783f 100644 --- a/src/test/scala/xyz/driver/pdsuicommon/logging/PhiStringContextSuite.scala +++ b/src/test/scala/xyz/driver/pdsuicommon/logging/PhiStringContextSuite.scala @@ -4,7 +4,7 @@ import org.scalatest.FreeSpecLike class PhiStringContextSuite extends FreeSpecLike { - class Foo(x: Int, y: String) { + case class Foo(x: Int, y: String) { val z: Boolean = true } diff --git a/src/test/scala/xyz/driver/pdsuicommon/parsers/TestUtils.scala b/src/test/scala/xyz/driver/pdsuicommon/parsers/TestUtils.scala index 09b60ed..8ab2131 100644 --- a/src/test/scala/xyz/driver/pdsuicommon/parsers/TestUtils.scala +++ b/src/test/scala/xyz/driver/pdsuicommon/parsers/TestUtils.scala @@ -21,7 +21,7 @@ object TestUtils { MatchResult( left.isFailure && left.failed.get.getClass == ct.runtimeClass, left match { - case Success(x) => s"$left did not fail" + case Success(_) => s"$left did not fail" case Failure(e) => s"$left did fail with ${Utils.getClassSimpleName(e.getClass)}, " + s"not ${Utils.getClassSimpleName(ct.runtimeClass)}" @@ -45,7 +45,7 @@ object TestUtils { def failureProp: Prop = self match { case Success(x) => false :| s"invalid: $x" - case Failure(e) => true + case Failure(_) => true } } diff --git a/src/test/scala/xyz/driver/pdsuicommon/utils/DiffUtils.scala b/src/test/scala/xyz/driver/pdsuicommon/utils/DiffUtils.scala deleted file mode 100644 index 156cb08..0000000 --- a/src/test/scala/xyz/driver/pdsuicommon/utils/DiffUtils.scala +++ /dev/null @@ -1,68 +0,0 @@ -package xyz.driver.pdsuicommon.utils - -import java.net.URI -import java.time.{LocalDate, LocalDateTime} - -import ai.x.diff._ -import org.scalatest.Assertions -import xyz.driver.pdsuidomain.entities.{Document, ExtractedData, MedicalRecord} - -import scala.io.AnsiColor - -trait DiffUtils { this: Assertions => - - def assertIdentical[T: DiffShow](left: T, right: T): Unit = { - val diff = DiffShow.diff(left, right) - assert(diff.isIdentical, s"\n${AnsiColor.RESET}$diff") // reset red color - } - - implicit def localTimeDiffShow: DiffShow[LocalDateTime] = new DiffShow[LocalDateTime] { - def show(x: LocalDateTime): String = s"LocalTime($x)" - def diff(left: LocalDateTime, right: LocalDateTime): Comparison = { - if (left.isEqual(right)) Identical(show(left)) - else Different(showChange(left, right)) - } - } - - implicit def localDateDiffShow: DiffShow[LocalDate] = new DiffShow[LocalDate] { - def show(x: LocalDate): String = s"LocalDate($x)" - def diff(left: LocalDate, right: LocalDate): Comparison = { - if (left.isEqual(right)) Identical(show(left)) - else Different(showChange(left, right)) - } - } - - implicit def urlDiffShow: DiffShow[URI] = new DiffShow[URI] { - def show(x: URI): String = s"URI($x)" - def diff(left: URI, right: URI): Comparison = { - if (left.equals(right)) Identical(show(left)) - else Different(showChange(left, right)) - } - } - - implicit def metaDiffShow: DiffShow[MedicalRecord.Meta] = new DiffShow[MedicalRecord.Meta] { - def show(x: MedicalRecord.Meta): String = s"MedicalRecord.Meta($x)" - def diff(left: MedicalRecord.Meta, right: MedicalRecord.Meta): Comparison = { - if (left.equals(right)) Identical(show(left)) - else Different(showChange(left, right)) - } - } - - implicit def extractedDataMetaDiffShow: DiffShow[ExtractedData.Meta] = new DiffShow[ExtractedData.Meta] { - def show(x: ExtractedData.Meta): String = s"ExtractedData.Meta($x)" - def diff(left: ExtractedData.Meta, right: ExtractedData.Meta): Comparison = { - if (left.equals(right)) Identical(show(left)) - else Different(showChange(left, right)) - } - } - - implicit def documentDiffShow: DiffShow[Document] = new DiffShow[Document] { - def show(x: Document): String = s"Document($x)" - - def diff(left: Document, right: Document): Comparison = { - if (left == right) Identical(show(left)) - else Different(showChange(left, right)) - } - } - -} diff --git a/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala index 63c4aa2..ccd5a3a 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala @@ -7,10 +7,9 @@ import org.scalatest.FreeSpecLike import org.scalatest.concurrent.ScalaFutures import org.scalatest.time.{Millis, Span} import xyz.driver.pdsuicommon.domain.{LongId, TextJson} -import xyz.driver.pdsuicommon.utils.DiffUtils import xyz.driver.pdsuidomain.entities.Document -class DocumentSuite extends FreeSpecLike with DiffUtils with ScalaFutures { +class DocumentSuite extends FreeSpecLike with ScalaFutures { implicit val defaultPatience: PatienceConfig = PatienceConfig(timeout = Span(1000, Millis), interval = Span(20, Millis)) |