Skip to content

Commit 8643c80

Browse files
authored
Merge branch 'Baeldung:master' into date-module-migration
2 parents 3948bcf + 078e50f commit 8643c80

File tree

45 files changed

+53
-75
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+53
-75
lines changed

build.sbt

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ lazy val scala_core_7 = (project in file("scala-core-modules/scala-core-7"))
9595
name := "scala-core-7",
9696
scalaVersion := scala3Version,
9797
libraryDependencies ++= scalaTestDeps,
98-
libraryDependencies += jUnitInterface,
98+
libraryDependencies += jUnitInterface
9999
)
100100

101101
lazy val scala_core_8 = (project in file("scala-core-modules/scala-core-8"))
@@ -111,9 +111,9 @@ lazy val scala_core_8 = (project in file("scala-core-modules/scala-core-8"))
111111
lazy val scala_core_io = (project in file("scala-core-modules/scala-core-io"))
112112
.settings(
113113
name := "scala-core-io",
114+
scalaVersion := scala3Version,
114115
libraryDependencies ++= scalaTestDeps,
115-
libraryDependencies += jUnitInterface,
116-
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value
116+
libraryDependencies += jUnitInterface
117117
)
118118

119119
lazy val scala_core_oop = (project in file("scala-core-modules/scala-core-oop"))
@@ -194,11 +194,11 @@ lazy val scala_core_map =
194194
lazy val scala_test = (project in file("scala-test"))
195195
.settings(
196196
name := "scala-test",
197+
scalaVersion := scala3Version,
197198
libraryDependencies ++=
198199
Seq(
199200
"org.scalatestplus" %% "mockito-3-4" % "3.2.10.0" % Test,
200-
jUnitInterface,
201-
scalaMock
201+
jUnitInterface
202202
) ++ scalaTestDeps
203203
)
204204

@@ -321,7 +321,7 @@ lazy val scala_libraries_2 = (project in file("scala-libraries-2"))
321321
),
322322
libraryDependencies ++= Seq(
323323
"org.playframework" %% "play-slick" % "6.0.0",
324-
"org.postgresql" % "postgresql" % "42.7.0"
324+
"org.postgresql" % "postgresql" % "42.7.1"
325325
),
326326
libraryDependencies ++= Seq(
327327
"io.monix" %% "monix" % monixVersion
@@ -373,6 +373,7 @@ lazy val scala_libraries_3 = (project in file("scala-libraries-3"))
373373
lazy val scala_libraries_os = (project in file("scala-libraries-os"))
374374
.settings(
375375
name := "scala-libraries",
376+
scalaVersion := scala3Version,
376377
libraryDependencies ++= scalaTestDeps,
377378
libraryDependencies ++= Seq(
378379
"org.apache.logging.log4j" %% "log4j-api-scala" % "13.0.0",
@@ -404,10 +405,10 @@ lazy val scala_libraries_4 = (project in file("scala-libraries-4"))
404405
"org.testcontainers" % "pulsar" % "1.19.3" % IntegrationTest
405406
),
406407
libraryDependencies ++= Seq(
407-
"software.amazon.awssdk" % "s3" % "2.21.37"
408+
"software.amazon.awssdk" % "s3" % "2.21.43"
408409
),
409410
libraryDependencies ++= Seq(
410-
"com.amazonaws" % "aws-java-sdk-s3" % "1.12.604" % IntegrationTest,
411+
"com.amazonaws" % "aws-java-sdk-s3" % "1.12.610" % IntegrationTest,
411412
"com.dimafeng" %% "testcontainers-scala-scalatest" % "0.41.0" % IntegrationTest,
412413
"com.dimafeng" %% "testcontainers-scala-localstack-v2" % "0.41.0" % IntegrationTest
413414
),
@@ -472,8 +473,9 @@ lazy val scala_strings = (project in file("scala-strings"))
472473
lazy val scala_design_patterns = (project in file("scala-design-patterns"))
473474
.settings(
474475
name := "scala-design-patterns",
476+
scalaVersion := scala3Version,
475477
libraryDependencies ++= scalaTestDeps,
476-
libraryDependencies += scalaMock,
478+
libraryDependencies += "org.scalatestplus" %% "mockito-3-4" % "3.2.10.0" % Test,
477479
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test
478480
)
479481

@@ -534,16 +536,18 @@ lazy val doobie = (project in file("doobie"))
534536
// lazy val scala_native = (project in file("scala-native"))
535537
// .settings(
536538
// name := "scala-native",
537-
// libraryDependencies += "com.lihaoyi" %%% "fansi" % "0.3.0"
539+
// scalaVersion := scala3Version,
540+
// libraryDependencies += "com.lihaoyi" %%% "fansi" % "0.4.0"
538541
// )
539542

540543
// ScalaPy Python Project is disabled as it needs clang and python to installed in the target machine.
541544
// To test this code, install clang, python and then uncommment this build
542545
// lazy val scala_python = (project in file("scala-python"))
543546
// .settings(
544547
// name := "scala-python",
545-
// libraryDependencies += "me.shadaj" %% "scalapy-core" % "0.5.2",
546-
// fork := true
548+
// libraryDependencies += "dev.scalapy" %%% "scalapy-core" % "0.5.3",
549+
// fork := true,
550+
// scalaVersion := scala3Version
547551
// )
548552

549553
lazy val reflection = (project in file("reflection"))
@@ -559,7 +563,9 @@ lazy val scala3_libraries = (project in file("scala3-libraries"))
559563
name := "scala3-libraries",
560564
libraryDependencies ++= Seq(
561565
"com.github.japgolly.clearconfig" %% "core" % "3.1.0",
562-
"org.scalameta" %% "munit" % "0.7.29" % Test
566+
"org.scalameta" %% "munit" % "0.7.29" % Test,
567+
"org.tpolecat" %% "doobie-core" % "1.0.0-RC2",
568+
"org.tpolecat" %% "doobie-postgres" % "1.0.0-RC2"
563569
)
564570
)
565571

@@ -612,7 +618,10 @@ addCommandAlias(
612618
lazy val playGroup = (project in file("play-scala"))
613619

614620
//Uncomment this to enable scala-js module. It needs nodejs module as well in local machine
615-
//lazy val scalajs = project in file("scala-js")
621+
//lazy val scalajs = (project in file("scala-js"))
622+
// .settings(
623+
// scalaVersion := scala3Version
624+
// )
616625
lazy val scalatra = project in file("scalatra")
617626
lazy val benchmark = project in file("specialized-benchmark")
618627

doobie/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

project/plugins.sbt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
1+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
22

3-
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.10")
4-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.0")
3+
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16")
4+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2")
55

66
addSbtPlugin("com.lightbend.akka.grpc" % "sbt-akka-grpc" % "2.2.1")
77
libraryDependencies += "ai.kien" %% "python-native-libs" % "0.2.4"
@@ -12,11 +12,11 @@ addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.0")
1212
addSbtPlugin("org.playframework.twirl" % "sbt-twirl" % "2.0.1")
1313
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "4.2.1")
1414

15-
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
16-
libraryDependencies += "org.scala-js" %% "scalajs-env-jsdom-nodejs" % "1.0.0"
15+
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.7")
16+
libraryDependencies += "org.scala-js" %% "scalajs-env-jsdom-nodejs" % "1.1.0"
1717

1818
resolvers += Resolver.jcenterRepo
1919

20-
addSbtPlugin("net.aichler" % "sbt-jupiter-interface" % "0.8.3")
20+
addSbtPlugin("net.aichler" % "sbt-jupiter-interface" % "0.8.4")
2121

2222
ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always

scala-core-modules/scala-core-io/src/main/scala-2/com/baeldung/scala/FileDeletion.scala renamed to scala-core-modules/scala-core-io/src/main/scala/com/baeldung/scala/FileDeletion.scala

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,8 @@ package com.baeldung.scala
33
import java.io.{File, IOException}
44
import java.nio.file.attribute.BasicFileAttributes
55
import java.nio.file.{FileVisitResult, Files, Path, SimpleFileVisitor}
6-
import scala.reflect.io.Directory
76

87
object FileDeletion {
9-
10-
def deletePureScalaDeletion(path: String): Unit = {
11-
new Directory(new File(path))
12-
.deleteRecursively()
13-
}
14-
158
def deleteRecursively(file: File): Unit = {
169
if (file.isDirectory) {
1710
file.listFiles.foreach(deleteRecursively)

scala-core-modules/scala-core-io/src/test/scala-2/com/baeldung/scala/io/FileDeletionTest.scala renamed to scala-core-modules/scala-core-io/src/test/scala/com/baeldung/scala/io/FileDeletionTest.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ class FileDeletionTest
3535
assert(!new File(path).exists())
3636
}
3737

38-
"delete with pure scala" should "delete all directory" in {
39-
FileDeletion.deletePureScalaDeletion(path)
40-
assert(!new File(path).exists())
41-
}
42-
4338
"delete recursively" should "delete all directory" in {
4439
FileDeletion.deleteRecursively(new File(path))
4540
assert(!new File(path).exists())

scala-design-patterns/src/main/scala-2/com/baeldung/scala/magnetpattern/MagnetPattern.scala renamed to scala-design-patterns/src/main/scala/com/baeldung/scala/magnetpattern/MagnetPattern.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.baeldung.scala.magnetpattern
22

3+
import scala.language.implicitConversions
4+
35
object MagnetPattern extends App {
46

57
/*
@@ -20,11 +22,15 @@ object MagnetPattern extends App {
2022

2123
def combineElements(magnet: CombineMagnet): magnet.Result = magnet()
2224

23-
implicit def intCombineMagnet(intList: List[Int]) = new CombineMagnet {
25+
implicit def intCombineMagnet(
26+
intList: List[Int]
27+
): CombineMagnet { type Result = Int } = new CombineMagnet {
2428
override type Result = Int
2529
override def apply(): Result = intList.reduce((i, c) => i + c)
2630
}
27-
implicit def strCombineMagnet(stringList: List[String]) = new CombineMagnet {
31+
implicit def strCombineMagnet(
32+
stringList: List[String]
33+
): CombineMagnet { type Result = String } = new CombineMagnet {
2834
override type Result = String
2935
override def apply(): Result = stringList.reduce((s, c) => s.concat(c))
3036
}

scala-design-patterns/src/test/scala-2/com/baeldung/scala/cakepattern/CakePatternUnitTest.scala renamed to scala-design-patterns/src/test/scala/com/baeldung/scala/cakepattern/CakePatternUnitTest.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
package com.baeldung.scala.cakepattern
22

33
import com.baeldung.scala.cakepattern.CakePattern.Test
4-
import org.scalamock.scalatest.MockFactory
4+
import org.mockito.Mockito.when
55
import org.scalatest.flatspec.AnyFlatSpec
6+
import org.scalatestplus.mockito.MockitoSugar
67

78
trait TestRegistry
89
extends CakePattern.TestExecutorComponent
910
with CakePattern.TestEnvironmentComponent
10-
with MockFactory {
11+
with MockitoSugar {
1112
override val env: TestEnvironment = mock[TestEnvironment]
1213
override val testExecutor: TestExecutor = new TestExecutor
1314
}
1415

1516
class CakePatternUnitTest extends AnyFlatSpec with TestRegistry {
1617

1718
"A TestExecutor" should "execute tests using a given environment" in {
18-
(env.readEnvironmentProperties _).expects().returning(Map("ENV" -> "true"))
19+
when(env.readEnvironmentProperties).thenReturn(Map("ENV" -> "true"))
1920
val test = Test(
2021
"test-1",
2122
{ environment =>

0 commit comments

Comments
 (0)