Skip to content

Travis fix for jdk11 #230

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

Merged
merged 8 commits into from
Dec 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ target/
# IntelliJ
.idea/

# VSCode
.bloop/
.metals/
project/metals.sbt

# ENSIME
.ensime
.ensime_lucene/
Expand Down
27 changes: 17 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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/

8 changes: 4 additions & 4 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down
10 changes: 5 additions & 5 deletions src/test/scala/com/typesafe/scalalogging/LoggerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ 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.
// I encapsulated that here in something that works across 2.12/2.13.
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

Expand Down Expand Up @@ -595,15 +595,15 @@ 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]
val arg5 = true
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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -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

Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand All @@ -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 {
Expand Down Expand Up @@ -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)
}
Expand Down