eloots / Pi-Akka-Cluster

Apache License 2.0
124 stars 33 forks source link

Compilation error when moving to Scalatest 3.1.0 #146

Closed eloots closed 4 years ago

eloots commented 4 years ago

@agolubev I did a short test with changing from ScalaTest 3.0.8 to 3.1.0.

Apart from the fact that there are deprecation warning (e.g. on WordSpec and Matcher), there are compilation errors related to code in eroled.SmartOLEDTest:

man [e] > Pi-Akka-Cluster > initial state > test
[info] Compiling 1 Scala source to /Users/ericloots/Trainingen/LightbendTraining/Pi-Akka-Cluster/common/target/scala-2.13/test-classes ...
[error] /Users/ericloots/Trainingen/LightbendTraining/Pi-Akka-Cluster/common/src/test/scala/eroled/SmartOLEDTest.scala:7:12: object scalatestplus is not a member of package org
[error] import org.scalatestplus.mockito.MockitoSugar
[error]            ^
[error] /Users/ericloots/Trainingen/LightbendTraining/Pi-Akka-Cluster/common/src/test/scala/eroled/SmartOLEDTest.scala:9:43: not found: type MockitoSugar
[error] class SmartOLEDTest extends WordSpec with MockitoSugar {
[error]                                           ^
[error] /Users/ericloots/Trainingen/LightbendTraining/Pi-Akka-Cluster/common/src/test/scala/eroled/SmartOLEDTest.scala:12:33: type mismatch;
[error]  found   : [T](x$1: Class[T], x$2: org.mockito.MockSettings)T <and> (x$1: Class[T], x$2: org.mockito.stubbing.Answer[_])T <and> (x$1: Class[T], x$2: String)T <and> (x$1: Class[T])T
[error]  required: eroled.SmartOLED
[error]          val a: SmartOLED = mock[SmartOLED]
[error]                                 ^
[error] /Users/ericloots/Trainingen/LightbendTraining/Pi-Akka-Cluster/common/src/test/scala/eroled/SmartOLEDTest.scala:26:33: type mismatch;
[error]  found   : [T](x$1: Class[T], x$2: org.mockito.MockSettings)T <and> (x$1: Class[T], x$2: org.mockito.stubbing.Answer[_])T <and> (x$1: Class[T], x$2: String)T <and> (x$1: Class[T])T
[error]  required: eroled.SmartOLED
[error]          val a: SmartOLED = mock[SmartOLED]
[error]                                 ^
[error] /Users/ericloots/Trainingen/LightbendTraining/Pi-Akka-Cluster/common/src/test/scala/eroled/SmartOLEDTest.scala:46:33: type mismatch;
[error]  found   : [T](x$1: Class[T], x$2: org.mockito.MockSettings)T <and> (x$1: Class[T], x$2: org.mockito.stubbing.Answer[_])T <and> (x$1: Class[T], x$2: String)T <and> (x$1: Class[T])T
[error]  required: eroled.SmartOLED
[error]          val a: SmartOLED = mock[SmartOLED]
[error]                                 ^
[warn] /Users/ericloots/Trainingen/LightbendTraining/Pi-Akka-Cluster/common/src/test/scala/eroled/SmartOLEDTest.scala:7:34: Unused import
[warn] import org.scalatestplus.mockito.MockitoSugar

Bumping powermock-api-mockito2 from 2.0.2 to 2.0.4 doesn't resolve the issue.

Would be great to figure out whats' happening and fix this when a solution is available so that we can move to ScalaTest 3.1.0

raboof commented 4 years ago

looks like it needs a scalatestplus-mockito dependency

agolubev commented 4 years ago

Yeah, need to revise my test dependencies. I remember made a few steps forward and backward so there can be few libraries that I'm not using in tests.

eloots commented 4 years ago

@agolubev Not that urgent: just wanted to give a heads-up. It's always good to stay up-to-date with the latest versions of the dependencies.

eloots commented 4 years ago

Eventually, we should also configure Scala Steward on this repo...

eloots commented 4 years ago

(and run tests systematically with Travis)

eloots commented 4 years ago

@agolubev Maybe the time has come to fix this? As said, when this is fixed, we can move to ScalaTest 3.10.0

agolubev commented 4 years ago

addressed this in #151

eloots commented 4 years ago

Thanks - Closing