diff --git a/.gitignore b/.gitignore index 10be92c..59b5bce 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,11 @@ target/ # IntelliJ .idea/ +# VSCode +.bloop/ +.metals/ +project/metals.sbt + # ENSIME .ensime .ensime_lucene/ diff --git a/.travis.yml b/.travis.yml index 31f5b93..e10815e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,23 @@ -sudo: required -dist: trusty +dist: bionic + language: scala scala: - - 2.12.11 + - 2.12.12 - 2.11.12 - - 2.13.1 -env: -- JDK=oraclejdk8 -- JDK=openjdk8 -- JDK=openjdk11 -before_script: - - jdk_switcher use $JDK + - 2.13.3 + +jdk: + - oraclejdk11 + - openjdk8 + - openjdk11 + script: - sbt "++ ${TRAVIS_SCALA_VERSION}!" test - git diff --exit-code # check scalariform + +cache: + directories: + - $HOME/.m2 + - $HOME/.ivy2/cache + - $HOME/.sbt/boot/ + diff --git a/project/Dependencies.scala b/project/Dependencies.scala index b9f880e..2e1e7e9 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -2,10 +2,10 @@ import sbt._ object Version { val logback = "1.2.3" - val mockito = "1.5.17" - val scala = "2.12.11" - val crossScala = List(scala, "2.11.12", "2.13.1") - val scalaTest = "3.0.8" + val mockito = "1.5.18" + val scala = "2.13.1" + val crossScala = List(scala, "2.11.12", "2.12.12") + val scalaTest = "3.2.1" val slf4j = "1.7.30" } diff --git a/src/test/scala/com/typesafe/scalalogging/LoggerSpec.scala b/src/test/scala/com/typesafe/scalalogging/LoggerSpec.scala index f97d6c6..0aef93d 100644 --- a/src/test/scala/com/typesafe/scalalogging/LoggerSpec.scala +++ b/src/test/scala/com/typesafe/scalalogging/LoggerSpec.scala @@ -21,8 +21,8 @@ import java.io._ import org.mockito.ArgumentMatchers._ import org.mockito.Mockito._ import org.slf4j.{ Logger => Underlying } -import org.scalatest.{ Matchers, WordSpec } -import org.scalatestplus.mockito.MockitoSugar +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec trait Varargs { // TODO: we used to wrap in List(...): _*, which I assume was to force the varags method to be chosen. @@ -30,7 +30,7 @@ trait Varargs { def forceVarargs[T](xs: T*): scala.Seq[T] = scala.Seq(xs: _*) } -class LoggerSpec extends WordSpec with Matchers with MockitoSugar with Varargs { +class LoggerSpec extends AnyWordSpec with Matchers with Varargs { // Error @@ -595,7 +595,7 @@ class LoggerSpec extends WordSpec with Matchers with MockitoSugar with Varargs { val msg = "msg" val cause = new RuntimeException("cause") val arg1 = "arg1" - val arg2 = new Integer(1) + val arg2 = Integer.valueOf(1) val arg3 = "arg3" val arg4 = 4 val arg4ref = arg4.asInstanceOf[AnyRef] @@ -603,7 +603,7 @@ class LoggerSpec extends WordSpec with Matchers with MockitoSugar with Varargs { val arg5ref = arg5.asInstanceOf[AnyRef] val arg6 = 6L val arg6ref = arg6.asInstanceOf[AnyRef] - val underlying = mock[org.slf4j.Logger] + val underlying = mock(classOf[org.slf4j.Logger]) when(p(underlying)).thenReturn(isEnabled) val logger = Logger(underlying) } diff --git a/src/test/scala/com/typesafe/scalalogging/LoggerTakingImplicitSpec.scala b/src/test/scala/com/typesafe/scalalogging/LoggerTakingImplicitSpec.scala index fe5fca8..ae78bbf 100644 --- a/src/test/scala/com/typesafe/scalalogging/LoggerTakingImplicitSpec.scala +++ b/src/test/scala/com/typesafe/scalalogging/LoggerTakingImplicitSpec.scala @@ -2,11 +2,11 @@ package com.typesafe.scalalogging import org.mockito.ArgumentMatchers._ import org.mockito.Mockito._ -import org.scalatestplus.mockito.MockitoSugar -import org.scalatest.{ Matchers, WordSpec } import org.slf4j.{ Logger => Underlying } +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec -class LoggerTakingImplicitSpec extends WordSpec with Matchers with MockitoSugar with Varargs { +class LoggerTakingImplicitSpec extends AnyWordSpec with Matchers with Varargs { case class CorrelationId(value: String) @@ -378,14 +378,14 @@ class LoggerTakingImplicitSpec extends WordSpec with Matchers with MockitoSugar def fixture(p: Underlying => Boolean, isEnabled: Boolean) = new { implicit val correlationId = CorrelationId("corrId") - implicit val canLogCorrelationId = mock[CanLog[CorrelationId]] + implicit val canLogCorrelationId = mock(classOf[CanLog[CorrelationId]]) val msg = "msg" val cause = new RuntimeException("cause") val arg1 = "arg1" - val arg2 = new Integer(1) + val arg2 = Integer.valueOf(1) val arg3 = "arg3" val logMsg = "corrId - msg" - val underlying = mock[org.slf4j.Logger] + val underlying = mock(classOf[org.slf4j.Logger]) when(p(underlying)).thenReturn(isEnabled) when(canLogCorrelationId.logMessage(anyString(), any[CorrelationId])).thenReturn(logMsg) val logger = Logger.takingImplicit[CorrelationId](underlying) diff --git a/src/test/scala/com/typesafe/scalalogging/LoggerWithMarkerSpec.scala b/src/test/scala/com/typesafe/scalalogging/LoggerWithMarkerSpec.scala index 21c20c2..51aad5c 100644 --- a/src/test/scala/com/typesafe/scalalogging/LoggerWithMarkerSpec.scala +++ b/src/test/scala/com/typesafe/scalalogging/LoggerWithMarkerSpec.scala @@ -21,8 +21,8 @@ import org.mockito.ArgumentMatchers._ import org.mockito.Mockito._ import org.slf4j.{ Logger => Underlying } import org.slf4j.Marker -import org.scalatest.{ Matchers, WordSpec } -import org.scalatestplus.mockito.MockitoSugar +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec object DummyMarker extends Marker { def add(childMarker: Marker): Unit = {} @@ -39,7 +39,7 @@ object DummyMarker extends Marker { def remove(child: Marker): Boolean = false } -class LoggerWithMarkerSpec extends WordSpec with Matchers with MockitoSugar with Varargs { +class LoggerWithMarkerSpec extends AnyWordSpec with Matchers with Varargs { // Error @@ -387,9 +387,9 @@ class LoggerWithMarkerSpec extends WordSpec with Matchers with MockitoSugar with val msg = "msg" val cause = new RuntimeException("cause") val arg1 = "arg1" - val arg2 = new Integer(1) + val arg2 = Integer.valueOf(1) val arg3 = "arg3" - val underlying = mock[org.slf4j.Logger] + val underlying = mock(classOf[org.slf4j.Logger]) when(p(underlying)(marker)).thenReturn(isEnabled) val logger = Logger(underlying) } diff --git a/src/test/scala/com/typesafe/scalalogging/LoggerWithTaggedArgsSpec.scala b/src/test/scala/com/typesafe/scalalogging/LoggerWithTaggedArgsSpec.scala index e6f6d0f..99c57ca 100644 --- a/src/test/scala/com/typesafe/scalalogging/LoggerWithTaggedArgsSpec.scala +++ b/src/test/scala/com/typesafe/scalalogging/LoggerWithTaggedArgsSpec.scala @@ -1,12 +1,9 @@ package com.typesafe.scalalogging -import org.scalatest.{ Matchers, WordSpec } - -import java.lang.ClassCastException import org.slf4j.{ Logger => Underlying } -import org.scalatestplus.mockito.MockitoSugar -import org.mockito.ArgumentMatchers._ import org.mockito.Mockito._ +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpec object tag { @@ -20,12 +17,10 @@ object tag { } } -class LoggerWithTaggedAargsSpec extends WordSpec with MockitoSugar with Matchers with Varargs { +class LoggerWithTaggedAargsSpec extends AnyWordSpec with Matchers with Varargs { trait Tag - import tag._ - "Calling error with tagged args" should { "not throw ClassCastException when varargs are passed" in { @@ -106,7 +101,7 @@ class LoggerWithTaggedAargsSpec extends WordSpec with MockitoSugar with Matchers new { val arg1 = tag[Tag][String]("arg1") val arg2 = tag[Tag][Integer](Integer.valueOf(1)) - val underlying = mock[org.slf4j.Logger] + val underlying = mock(classOf[org.slf4j.Logger]) when(p(underlying)).thenReturn(isEnabled) val logger = Logger(underlying) }