Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparing Arrays throws an Exception #28

Open
angelcervera opened this issue Nov 5, 2018 · 0 comments
Open

Comparing Arrays throws an Exception #28

angelcervera opened this issue Nov 5, 2018 · 0 comments

Comments

@angelcervera
Copy link

Test with Array of bytes:

  "diff Arrays of bytes" in {
    case class CaseClassWithArrayBytes(id: String, hash: Option[Array[Byte]])

    import ai.x.diff.DiffShow
    import ai.x.diff.conversions._
    println(
      DiffShow.diff[CaseClassWithArrayBytes](
        CaseClassWithArrayBytes("A", Some( Array[Byte](192.toByte, 168.toByte) )),
        CaseClassWithArrayBytes("B", Some( Array[Byte](192.toByte, 168.toByte) ))
      ).toString
    )

  }

It prints the exception:

Different(CaseClassWithArrayBytes$3(
  hash = Some(
    java.lang.Exception: ERROR: Cannot find DiffShow[Array[byte]] to show values ([B@13a37e2a, [B@a50ae65)
    	at ai.x.diff.DiffShowInstancesLowPriority$$anon$4.diff(diff.scala:110)
    	at ai.x.diff.DiffShowInstancesLowPriority$$anon$4.diff(diff.scala:106)
    	at ai.x.diff.DiffShow$.diff(diff.scala:64)
    	at ai.x.diff.DiffShowInstances$$anon$5.diff(diff.scala:122)
    	at ai.x.diff.DiffShowInstances$$anon$5.diff(diff.scala:115)
    	at ai.x.diff.DiffShow$.diff(diff.scala:64)
    	at ai.x.diff.DiffShowFields$$anon$3.diff(diff.scala:99)
    	at ai.x.diff.DiffShowFields$$anon$3.diff(diff.scala:95)
    	at ai.x.diff.DiffShowFields$$anon$3.diff(diff.scala:99)
    	at ai.x.diff.DiffShowFields$$anon$3.diff(diff.scala:95)
    	at ai.x.diff.DiffShowInstances$CaseClassDiffShow.diff(diff.scala:201)
    	at ai.x.diff.DiffShow$.diff(diff.scala:64)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest$$anonfun$2.apply$mcV$sp(CompareDatasetsTest.scala:30)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest$$anonfun$2.apply(CompareDatasetsTest.scala:24)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest$$anonfun$2.apply(CompareDatasetsTest.scala:24)
    	at org.scalatest.OutcomeOf$class.outcomeOf(OutcomeOf.scala:85)
    	at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
    	at org.scalatest.Transformer.apply(Transformer.scala:22)
    	at org.scalatest.Transformer.apply(Transformer.scala:20)
    	at org.scalatest.WordSpecLike$$anon$1.apply(WordSpecLike.scala:1078)
    	at org.scalatest.TestSuite$class.withFixture(TestSuite.scala:196)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest.withFixture(CompareDatasetsTest.scala:7)
    	at org.scalatest.WordSpecLike$class.invokeWithFixture$1(WordSpecLike.scala:1075)
    	at org.scalatest.WordSpecLike$$anonfun$runTest$1.apply(WordSpecLike.scala:1088)
    	at org.scalatest.WordSpecLike$$anonfun$runTest$1.apply(WordSpecLike.scala:1088)
    	at org.scalatest.SuperEngine.runTestImpl(Engine.scala:289)
    	at org.scalatest.WordSpecLike$class.runTest(WordSpecLike.scala:1088)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest.runTest(CompareDatasetsTest.scala:7)
    	at org.scalatest.WordSpecLike$$anonfun$runTests$1.apply(WordSpecLike.scala:1147)
    	at org.scalatest.WordSpecLike$$anonfun$runTests$1.apply(WordSpecLike.scala:1147)
    	at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:396)
    	at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:384)
    	at scala.collection.immutable.List.foreach(List.scala:381)
    	at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384)
    	at org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:379)
    	at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:461)
    	at org.scalatest.WordSpecLike$class.runTests(WordSpecLike.scala:1147)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest.runTests(CompareDatasetsTest.scala:7)
    	at org.scalatest.Suite$class.run(Suite.scala:1147)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest.org$scalatest$WordSpecLike$$super$run(CompareDatasetsTest.scala:7)
    	at org.scalatest.WordSpecLike$$anonfun$run$1.apply(WordSpecLike.scala:1192)
    	at org.scalatest.WordSpecLike$$anonfun$run$1.apply(WordSpecLike.scala:1192)
    	at org.scalatest.SuperEngine.runImpl(Engine.scala:521)
    	at org.scalatest.WordSpecLike$class.run(WordSpecLike.scala:1192)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest.run(CompareDatasetsTest.scala:7)
    	at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:45)
    	at org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$1.apply(Runner.scala:1346)
    	at org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$1.apply(Runner.scala:1340)
    	at scala.collection.immutable.List.foreach(List.scala:381)
    	at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1340)
    	at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1011)
    	at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1010)
    	at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1506)
    	at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1010)
    	at org.scalatest.tools.Runner$.run(Runner.scala:850)
    	at org.scalatest.tools.Runner.run(Runner.scala)
    	at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:131)
    	at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:28)
  
  ),
  id = "A" -> "B"
))

Test with Array of Strings:

  "diff Arrays of String" in {
    case class CaseClassWithArrayStrings(id: String, hash: Option[Array[String]])

    import ai.x.diff.DiffShow
    import ai.x.diff.conversions._
    println(
      DiffShow.diff[CaseClassWithArrayStrings](
        CaseClassWithArrayStrings("A", Some( Array[String]("A","B") )),
        CaseClassWithArrayStrings("B", Some( Array[String]("A", "B") ))
      ).toString
    )
  }

Prints the exception:

Different(CaseClassWithArrayStrings$3(
  hash = Some(
    java.lang.Exception: ERROR: Cannot find DiffShow[Array[java.lang.String]] to show values ([Ljava.lang.String;@18324f97, [Ljava.lang.String;@64f555e7)
    	at ai.x.diff.DiffShowInstancesLowPriority$$anon$4.diff(diff.scala:110)
    	at ai.x.diff.DiffShowInstancesLowPriority$$anon$4.diff(diff.scala:106)
    	at ai.x.diff.DiffShow$.diff(diff.scala:64)
    	at ai.x.diff.DiffShowInstances$$anon$5.diff(diff.scala:122)
    	at ai.x.diff.DiffShowInstances$$anon$5.diff(diff.scala:115)
    	at ai.x.diff.DiffShow$.diff(diff.scala:64)
    	at ai.x.diff.DiffShowFields$$anon$3.diff(diff.scala:99)
    	at ai.x.diff.DiffShowFields$$anon$3.diff(diff.scala:95)
    	at ai.x.diff.DiffShowFields$$anon$3.diff(diff.scala:99)
    	at ai.x.diff.DiffShowFields$$anon$3.diff(diff.scala:95)
    	at ai.x.diff.DiffShowInstances$CaseClassDiffShow.diff(diff.scala:201)
    	at ai.x.diff.DiffShow$.diff(diff.scala:64)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest$$anonfun$3.apply$mcV$sp(CompareDatasetsTest.scala:43)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest$$anonfun$3.apply(CompareDatasetsTest.scala:37)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest$$anonfun$3.apply(CompareDatasetsTest.scala:37)
    	at org.scalatest.OutcomeOf$class.outcomeOf(OutcomeOf.scala:85)
    	at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
    	at org.scalatest.Transformer.apply(Transformer.scala:22)
    	at org.scalatest.Transformer.apply(Transformer.scala:20)
    	at org.scalatest.WordSpecLike$$anon$1.apply(WordSpecLike.scala:1078)
    	at org.scalatest.TestSuite$class.withFixture(TestSuite.scala:196)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest.withFixture(CompareDatasetsTest.scala:7)
    	at org.scalatest.WordSpecLike$class.invokeWithFixture$1(WordSpecLike.scala:1075)
    	at org.scalatest.WordSpecLike$$anonfun$runTest$1.apply(WordSpecLike.scala:1088)
    	at org.scalatest.WordSpecLike$$anonfun$runTest$1.apply(WordSpecLike.scala:1088)
    	at org.scalatest.SuperEngine.runTestImpl(Engine.scala:289)
    	at org.scalatest.WordSpecLike$class.runTest(WordSpecLike.scala:1088)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest.runTest(CompareDatasetsTest.scala:7)
    	at org.scalatest.WordSpecLike$$anonfun$runTests$1.apply(WordSpecLike.scala:1147)
    	at org.scalatest.WordSpecLike$$anonfun$runTests$1.apply(WordSpecLike.scala:1147)
    	at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:396)
    	at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:384)
    	at scala.collection.immutable.List.foreach(List.scala:381)
    	at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384)
    	at org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:379)
    	at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:461)
    	at org.scalatest.WordSpecLike$class.runTests(WordSpecLike.scala:1147)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest.runTests(CompareDatasetsTest.scala:7)
    	at org.scalatest.Suite$class.run(Suite.scala:1147)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest.org$scalatest$WordSpecLike$$super$run(CompareDatasetsTest.scala:7)
    	at org.scalatest.WordSpecLike$$anonfun$run$1.apply(WordSpecLike.scala:1192)
    	at org.scalatest.WordSpecLike$$anonfun$run$1.apply(WordSpecLike.scala:1192)
    	at org.scalatest.SuperEngine.runImpl(Engine.scala:521)
    	at org.scalatest.WordSpecLike$class.run(WordSpecLike.scala:1192)
    	at com.dnb.optimus.prime.report.CompareDatasetsTest.run(CompareDatasetsTest.scala:7)
    	at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:45)
    	at org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$1.apply(Runner.scala:1346)
    	at org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$1.apply(Runner.scala:1340)
    	at scala.collection.immutable.List.foreach(List.scala:381)
    	at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1340)
    	at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1011)
    	at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1010)
    	at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1506)
    	at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1010)
    	at org.scalatest.tools.Runner$.run(Runner.scala:850)
    	at org.scalatest.tools.Runner.run(Runner.scala)
    	at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:131)
    	at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:28)
  
  ),
  id = "A" -> "B"
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant