Skip to content

Commit 2a4ccdf

Browse files
authored
Travis fix for jdk11 (#230)
* Travis fix for jdk11 * Add caching scala deps * Fix various warnings in code * Update deprecated travis image and don't require sudo * Update scala and make 2.13 default * Bump mockito-scala * Scalatest 3.2.2 * Revert scala to 2.13.1
1 parent 514e283 commit 2a4ccdf

File tree

7 files changed

+46
-39
lines changed

7 files changed

+46
-39
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ target/
1818
# IntelliJ
1919
.idea/
2020

21+
# VSCode
22+
.bloop/
23+
.metals/
24+
project/metals.sbt
25+
2126
# ENSIME
2227
.ensime
2328
.ensime_lucene/

.travis.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
sudo: required
2-
dist: trusty
1+
dist: bionic
2+
33
language: scala
44
scala:
5-
- 2.12.11
5+
- 2.12.12
66
- 2.11.12
7-
- 2.13.1
8-
env:
9-
- JDK=oraclejdk8
10-
- JDK=openjdk8
11-
- JDK=openjdk11
12-
before_script:
13-
- jdk_switcher use $JDK
7+
- 2.13.3
8+
9+
jdk:
10+
- oraclejdk11
11+
- openjdk8
12+
- openjdk11
13+
1414
script:
1515
- sbt "++ ${TRAVIS_SCALA_VERSION}!" test
1616
- git diff --exit-code # check scalariform
17+
18+
cache:
19+
directories:
20+
- $HOME/.m2
21+
- $HOME/.ivy2/cache
22+
- $HOME/.sbt/boot/
23+

project/Dependencies.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import sbt._
22

33
object Version {
44
val logback = "1.2.3"
5-
val mockito = "1.5.17"
6-
val scala = "2.12.11"
7-
val crossScala = List(scala, "2.11.12", "2.13.1")
8-
val scalaTest = "3.0.8"
5+
val mockito = "1.5.18"
6+
val scala = "2.13.1"
7+
val crossScala = List(scala, "2.11.12", "2.12.12")
8+
val scalaTest = "3.2.1"
99
val slf4j = "1.7.30"
1010
}
1111

src/test/scala/com/typesafe/scalalogging/LoggerSpec.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ import java.io._
2121
import org.mockito.ArgumentMatchers._
2222
import org.mockito.Mockito._
2323
import org.slf4j.{ Logger => Underlying }
24-
import org.scalatest.{ Matchers, WordSpec }
25-
import org.scalatestplus.mockito.MockitoSugar
24+
import org.scalatest.matchers.should.Matchers
25+
import org.scalatest.wordspec.AnyWordSpec
2626

2727
trait Varargs {
2828
// TODO: we used to wrap in List(...): _*, which I assume was to force the varags method to be chosen.
2929
// I encapsulated that here in something that works across 2.12/2.13.
3030
def forceVarargs[T](xs: T*): scala.Seq[T] = scala.Seq(xs: _*)
3131
}
3232

33-
class LoggerSpec extends WordSpec with Matchers with MockitoSugar with Varargs {
33+
class LoggerSpec extends AnyWordSpec with Matchers with Varargs {
3434

3535
// Error
3636

@@ -595,15 +595,15 @@ class LoggerSpec extends WordSpec with Matchers with MockitoSugar with Varargs {
595595
val msg = "msg"
596596
val cause = new RuntimeException("cause")
597597
val arg1 = "arg1"
598-
val arg2 = new Integer(1)
598+
val arg2 = Integer.valueOf(1)
599599
val arg3 = "arg3"
600600
val arg4 = 4
601601
val arg4ref = arg4.asInstanceOf[AnyRef]
602602
val arg5 = true
603603
val arg5ref = arg5.asInstanceOf[AnyRef]
604604
val arg6 = 6L
605605
val arg6ref = arg6.asInstanceOf[AnyRef]
606-
val underlying = mock[org.slf4j.Logger]
606+
val underlying = mock(classOf[org.slf4j.Logger])
607607
when(p(underlying)).thenReturn(isEnabled)
608608
val logger = Logger(underlying)
609609
}

src/test/scala/com/typesafe/scalalogging/LoggerTakingImplicitSpec.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ package com.typesafe.scalalogging
22

33
import org.mockito.ArgumentMatchers._
44
import org.mockito.Mockito._
5-
import org.scalatestplus.mockito.MockitoSugar
6-
import org.scalatest.{ Matchers, WordSpec }
75
import org.slf4j.{ Logger => Underlying }
6+
import org.scalatest.matchers.should.Matchers
7+
import org.scalatest.wordspec.AnyWordSpec
88

9-
class LoggerTakingImplicitSpec extends WordSpec with Matchers with MockitoSugar with Varargs {
9+
class LoggerTakingImplicitSpec extends AnyWordSpec with Matchers with Varargs {
1010

1111
case class CorrelationId(value: String)
1212

@@ -378,14 +378,14 @@ class LoggerTakingImplicitSpec extends WordSpec with Matchers with MockitoSugar
378378
def fixture(p: Underlying => Boolean, isEnabled: Boolean) =
379379
new {
380380
implicit val correlationId = CorrelationId("corrId")
381-
implicit val canLogCorrelationId = mock[CanLog[CorrelationId]]
381+
implicit val canLogCorrelationId = mock(classOf[CanLog[CorrelationId]])
382382
val msg = "msg"
383383
val cause = new RuntimeException("cause")
384384
val arg1 = "arg1"
385-
val arg2 = new Integer(1)
385+
val arg2 = Integer.valueOf(1)
386386
val arg3 = "arg3"
387387
val logMsg = "corrId - msg"
388-
val underlying = mock[org.slf4j.Logger]
388+
val underlying = mock(classOf[org.slf4j.Logger])
389389
when(p(underlying)).thenReturn(isEnabled)
390390
when(canLogCorrelationId.logMessage(anyString(), any[CorrelationId])).thenReturn(logMsg)
391391
val logger = Logger.takingImplicit[CorrelationId](underlying)

src/test/scala/com/typesafe/scalalogging/LoggerWithMarkerSpec.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import org.mockito.ArgumentMatchers._
2121
import org.mockito.Mockito._
2222
import org.slf4j.{ Logger => Underlying }
2323
import org.slf4j.Marker
24-
import org.scalatest.{ Matchers, WordSpec }
25-
import org.scalatestplus.mockito.MockitoSugar
24+
import org.scalatest.matchers.should.Matchers
25+
import org.scalatest.wordspec.AnyWordSpec
2626

2727
object DummyMarker extends Marker {
2828
def add(childMarker: Marker): Unit = {}
@@ -39,7 +39,7 @@ object DummyMarker extends Marker {
3939
def remove(child: Marker): Boolean = false
4040
}
4141

42-
class LoggerWithMarkerSpec extends WordSpec with Matchers with MockitoSugar with Varargs {
42+
class LoggerWithMarkerSpec extends AnyWordSpec with Matchers with Varargs {
4343

4444
// Error
4545

@@ -387,9 +387,9 @@ class LoggerWithMarkerSpec extends WordSpec with Matchers with MockitoSugar with
387387
val msg = "msg"
388388
val cause = new RuntimeException("cause")
389389
val arg1 = "arg1"
390-
val arg2 = new Integer(1)
390+
val arg2 = Integer.valueOf(1)
391391
val arg3 = "arg3"
392-
val underlying = mock[org.slf4j.Logger]
392+
val underlying = mock(classOf[org.slf4j.Logger])
393393
when(p(underlying)(marker)).thenReturn(isEnabled)
394394
val logger = Logger(underlying)
395395
}

src/test/scala/com/typesafe/scalalogging/LoggerWithTaggedArgsSpec.scala

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
package com.typesafe.scalalogging
22

3-
import org.scalatest.{ Matchers, WordSpec }
4-
5-
import java.lang.ClassCastException
63
import org.slf4j.{ Logger => Underlying }
7-
import org.scalatestplus.mockito.MockitoSugar
8-
import org.mockito.ArgumentMatchers._
94
import org.mockito.Mockito._
5+
import org.scalatest.matchers.should.Matchers
6+
import org.scalatest.wordspec.AnyWordSpec
107

118
object tag {
129

@@ -20,12 +17,10 @@ object tag {
2017
}
2118
}
2219

23-
class LoggerWithTaggedAargsSpec extends WordSpec with MockitoSugar with Matchers with Varargs {
20+
class LoggerWithTaggedAargsSpec extends AnyWordSpec with Matchers with Varargs {
2421

2522
trait Tag
2623

27-
import tag._
28-
2924
"Calling error with tagged args" should {
3025

3126
"not throw ClassCastException when varargs are passed" in {
@@ -106,7 +101,7 @@ class LoggerWithTaggedAargsSpec extends WordSpec with MockitoSugar with Matchers
106101
new {
107102
val arg1 = tag[Tag][String]("arg1")
108103
val arg2 = tag[Tag][Integer](Integer.valueOf(1))
109-
val underlying = mock[org.slf4j.Logger]
104+
val underlying = mock(classOf[org.slf4j.Logger])
110105
when(p(underlying)).thenReturn(isEnabled)
111106
val logger = Logger(underlying)
112107
}

0 commit comments

Comments
 (0)