File tree Expand file tree Collapse file tree 5 files changed +10
-6
lines changed
scala-design-patterns/src
main/scala/com/baeldung/scala
test/scala/com/baeldung/scala Expand file tree Collapse file tree 5 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -472,8 +472,9 @@ lazy val scala_strings = (project in file("scala-strings"))
472472lazy val scala_design_patterns = (project in file(" scala-design-patterns" ))
473473 .settings(
474474 name := " scala-design-patterns" ,
475+ scalaVersion := scala3Version,
475476 libraryDependencies ++= scalaTestDeps,
476- libraryDependencies += scalaMock ,
477+ libraryDependencies += " org.scalatestplus " %% " mockito-3-4 " % " 3.2.10.0 " % Test ,
477478 libraryDependencies += " com.novocode" % " junit-interface" % " 0.11" % Test
478479 )
479480
File renamed without changes.
Original file line number Diff line number Diff line change 11package com .baeldung .scala .magnetpattern
22
3+ import scala .language .implicitConversions
4+
35object MagnetPattern extends App {
46
57 /*
@@ -20,11 +22,11 @@ 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 (intList : List [Int ]): CombineMagnet { type Result = Int } = new CombineMagnet {
2426 override type Result = Int
2527 override def apply (): Result = intList.reduce((i, c) => i + c)
2628 }
27- implicit def strCombineMagnet (stringList : List [String ]) = new CombineMagnet {
29+ implicit def strCombineMagnet (stringList : List [String ]): CombineMagnet { type Result = String } = new CombineMagnet {
2830 override type Result = String
2931 override def apply (): Result = stringList.reduce((s, c) => s.concat(c))
3032 }
Original file line number Diff line number Diff line change 11package com .baeldung .scala .cakepattern
22
33import com .baeldung .scala .cakepattern .CakePattern .Test
4- import org .scalamock . scalatest . MockFactory
4+ import org .mockito . Mockito . when
55import org .scalatest .flatspec .AnyFlatSpec
6+ import org .scalatestplus .mockito .MockitoSugar
67
78trait 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
1516class 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 =>
File renamed without changes.
You can’t perform that action at this time.
0 commit comments