Skip to content

Commit 6140c78

Browse files
committed
Reformat with scalafmt 3.9.7
Executed command: scalafmt --non-interactive
1 parent 3af7b0d commit 6140c78

File tree

18 files changed

+54
-54
lines changed

18 files changed

+54
-54
lines changed

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ lazy val commonSettings =
6464
lazy val publishSettings = Seq(
6565
licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT")),
6666
homepage := Some(url("https://github.com/mockito/mockito-scala")),
67-
scmInfo := Some(
67+
scmInfo := Some(
6868
ScmInfo(
6969
url("https://github.com/mockito/mockito-scala"),
7070
"[email protected]:mockito/mockito-scala.git"
@@ -123,7 +123,7 @@ lazy val cats = (project in file("cats"))
123123
publishSettings,
124124
libraryDependencies ++= Seq(
125125
Dependencies.cats,
126-
Dependencies.catsLaws % "test",
126+
Dependencies.catsLaws % "test",
127127
Dependencies.disciplineScalatest % "test",
128128
Dependencies.scalatest % "test"
129129
)

common/src/main/scala/org/mockito/ReflectionUtils.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ object ReflectionUtils {
2424

2525
implicit def symbolToMethodSymbol(sym: Symbol): Symbols#MethodSymbol = sym.asInstanceOf[Symbols#MethodSymbol]
2626

27-
private val mirror = runtimeMirror(getClass.getClassLoader)
27+
private val mirror = runtimeMirror(getClass.getClassLoader)
2828
private val customMirror = mirror.asInstanceOf[{
2929
def methodToJava(sym: Symbols#MethodSymbol): Method
3030
}]
@@ -130,7 +130,7 @@ object ReflectionUtils {
130130
field.setAccessible(true)
131131
val modifiersField: Field = uTry(clazz.getDeclaredField("modifiers")) match {
132132
case Success(modifiers) => modifiers
133-
case Failure(e) =>
133+
case Failure(e) =>
134134
uTry {
135135
val getDeclaredFields0 = clazz.getDeclaredMethod("getDeclaredFields0", classOf[Boolean])
136136
val accessibleBeforeSet: Boolean = getDeclaredFields0.isAccessible
@@ -142,7 +142,7 @@ object ReflectionUtils {
142142
declaredFields.find("modifiers" == _.getName).get
143143
} match {
144144
case Success(modifiers) => modifiers
145-
case Failure(ex) =>
145+
case Failure(ex) =>
146146
e.addSuppressed(ex)
147147
throw e
148148
}

common/src/main/scala/org/mockito/internal/handler/ScalaMockHandler.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ScalaMockHandler[T](mockSettings: MockCreationSettings[T], methodsToProces
2727
i.callRealMethod()
2828
else {
2929
val rawArguments = i.getRawArguments
30-
val arguments =
30+
val arguments =
3131
if (rawArguments != null && rawArguments.nonEmpty && !isCallRealMethod) unwrapArgs(method, rawArguments)
3232
else rawArguments
3333

@@ -42,18 +42,18 @@ class ScalaMockHandler[T](mockSettings: MockCreationSettings[T], methodsToProces
4242
val transformed = methodsToProcess
4343
.collectFirst {
4444
case (mtd, indices) if method === mtd =>
45-
val argumentMatcherStorage = mockingProgress().getArgumentMatcherStorage
46-
val matchers = argumentMatcherStorage.pullLocalizedMatchers().asScala.toIterator
47-
val matchersWereUsed = matchers.nonEmpty
48-
def reportMatcher(): Unit = if (matchers.nonEmpty) argumentMatcherStorage.reportMatcher(matchers.next().getMatcher)
45+
val argumentMatcherStorage = mockingProgress().getArgumentMatcherStorage
46+
val matchers = argumentMatcherStorage.pullLocalizedMatchers().asScala.toIterator
47+
val matchersWereUsed = matchers.nonEmpty
48+
def reportMatcher(): Unit = if (matchers.nonEmpty) argumentMatcherStorage.reportMatcher(matchers.next().getMatcher)
4949
def reportMatchers(varargs: Iterable[_]): Unit =
5050
if (matchersWereUsed && varargs.nonEmpty) {
5151
def reportAsEqTo(): Unit = varargs.map(EqTo(_)).foreach(argumentMatcherStorage.reportMatcher(_))
5252
val matcher = matchers.next().getMatcher
5353
matcher match {
5454
case EqTo(value: Array[_]) if varargs.sameElements(value) => reportAsEqTo()
5555
case EqTo(value) if varargs == value => reportAsEqTo()
56-
case other =>
56+
case other =>
5757
argumentMatcherStorage.reportMatcher(other)
5858
varargs.drop(1).foreach(_ => reportMatcher())
5959
}
@@ -100,7 +100,7 @@ object ScalaMockHandler {
100100
mockSettings
101101
)
102102

103-
private val InvocationClassName = classOf[ScalaInvocation].getName
103+
private val InvocationClassName = classOf[ScalaInvocation].getName
104104
private def isCallRealMethod: Boolean =
105105
(new Exception).getStackTrace.toList.exists { t =>
106106
t.getClassName == InvocationClassName &&

common/src/main/scala/org/mockito/internal/invocation/ScalaInvocation.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ScalaInvocation(
4545
override def isVerified: Boolean = verified || isIgnoredForVerification
4646
override def getMock: AnyRef = mockRef.get
4747
override def getMethod: Method = mockitoMethod.getJavaMethod
48-
override def callRealMethod(): AnyRef =
48+
override def callRealMethod(): AnyRef =
4949
if (realMethod.isInvokable) realMethod.invoke
5050
else throw cannotCallAbstractRealMethod
5151

@@ -62,7 +62,7 @@ class ScalaInvocation(
6262
val state = Seq(super.hashCode(), getMock, mockitoMethod, arguments.toSeq)
6363
state.map(_.hashCode()).foldLeft(0)((a, b) => 31 * a + b)
6464
}
65-
override def toString: String = new PrintSettings().print(getArgumentsAsMatchers, this)
65+
override def toString: String = new PrintSettings().print(getArgumentsAsMatchers, this)
6666
override def getArgumentsAsMatchers: util.List[ArgumentMatcher[_]] =
6767
arguments.map(EqTo(_)(serialisableEquality[AnyRef], ValueClassExtractor.instance[AnyRef], $pt): ArgumentMatcher[_]).toList.asJava
6868
}

common/src/main/scala/org/mockito/stubbing/ScalaBaseStubbing.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ abstract class ScalaBaseStubbing[T: ValueClassExtractor] {
2929

3030
protected def _thenCallRealMethod(): ScalaOngoingStubbing[T] = delegate.thenCallRealMethod()
3131

32-
protected def _thenAnswer(f: => T): ScalaOngoingStubbing[T] = delegate thenAnswer invocationToAnswer(_ => f)
32+
protected def _thenAnswer(f: => T): ScalaOngoingStubbing[T] = delegate thenAnswer invocationToAnswer(_ => f)
3333
protected def _thenAnswer[P0: ClassTag: ValueClassWrapper](f: P0 => T): ScalaOngoingStubbing[T] =
3434
clazz[P0] match {
3535
case c if c == classOf[InvocationOnMock] => delegate thenAnswer invocationToAnswer(i => f(i.asInstanceOf[P0]))

common/src/main/scala/org/mockito/stubbing/ScalaFirstStubbing.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ case class ScalaFirstStubbing[T: ValueClassExtractor](delegate: OngoingStubbing[
9898
}
9999
}
100100

101-
def thenAnswer(f: => T): ScalaOngoingStubbing[T] = _thenAnswer(f)
101+
def thenAnswer(f: => T): ScalaOngoingStubbing[T] = _thenAnswer(f)
102102
def thenAnswer[P0: ValueClassWrapper](f: P0 => T)(implicit classTag: ClassTag[P0] = defaultClassTag[P0]): ScalaOngoingStubbing[T] =
103103
_thenAnswer(f)
104104
def thenAnswer[P0: ValueClassWrapper, P1: ValueClassWrapper](f: (P0, P1) => T): ScalaOngoingStubbing[T] =

common/src/main/scala/org/mockito/stubbing/ScalaOngoingStubbing.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ case class ScalaOngoingStubbing[T: ValueClassExtractor](delegate: OngoingStubbin
7878
*/
7979
def andThenCallRealMethod(): ScalaOngoingStubbing[T] = _thenCallRealMethod()
8080

81-
def andThenAnswer(f: => T): ScalaOngoingStubbing[T] = _thenAnswer(f)
81+
def andThenAnswer(f: => T): ScalaOngoingStubbing[T] = _thenAnswer(f)
8282
def andThenAnswer[P0: ValueClassWrapper](f: P0 => T)(implicit classTag: ClassTag[P0] = defaultClassTag[P0]): ScalaOngoingStubbing[T] =
8383
_thenAnswer(f)
8484
def andThenAnswer[P0: ValueClassWrapper, P1: ValueClassWrapper](f: (P0, P1) => T): ScalaOngoingStubbing[T] =

core/src/main/scala/org/mockito/IdiomaticMockitoBase.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object IdiomaticMockitoBase {
3232

3333
case class Times(times: Int) extends ScalaVerificationMode {
3434
override def verificationMode: VerificationMode = Mockito.times(times)
35-
def within(d: Duration): ScalaVerificationMode =
35+
def within(d: Duration): ScalaVerificationMode =
3636
new ScalaVerificationMode {
3737
override def verificationMode: VerificationMode = Mockito.timeout(d.toMillis).times(times)
3838
}
@@ -53,7 +53,7 @@ object IdiomaticMockitoBase {
5353

5454
case class AtLeast(times: Int) extends ScalaVerificationMode {
5555
override def verificationMode: VerificationMode = Mockito.atLeast(times)
56-
def within(d: Duration): ScalaVerificationMode =
56+
def within(d: Duration): ScalaVerificationMode =
5757
new ScalaVerificationMode {
5858
override def verificationMode: VerificationMode = Mockito.timeout(d.toMillis).atLeast(times)
5959
}
@@ -65,15 +65,15 @@ object IdiomaticMockitoBase {
6565

6666
case class AtMost(times: Int) extends ScalaVerificationMode {
6767
override def verificationMode: VerificationMode = Mockito.atMost(times)
68-
def after(d: Duration): ScalaVerificationMode =
68+
def after(d: Duration): ScalaVerificationMode =
6969
new ScalaVerificationMode {
7070
override def verificationMode: VerificationMode = Mockito.after(d.toMillis).atMost(times)
7171
}
7272
}
7373

7474
object OnlyOn extends ScalaVerificationMode {
7575
override def verificationMode: VerificationMode = Mockito.only
76-
def within(d: Duration): ScalaVerificationMode =
76+
def within(d: Duration): ScalaVerificationMode =
7777
new ScalaVerificationMode {
7878
override def verificationMode: VerificationMode = Mockito.timeout(d.toMillis).only
7979
}

macro-common/src/main/scala/org/mockito/internal/ValueClassExtractor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class NormalClassExtractor[T] extends ValueClassExtractor[T] {
1919
class ReflectionExtractor[VC] extends ValueClassExtractor[VC] {
2020
override def extract(vc: VC): Any = {
2121
val constructorParam = vc.getClass.getConstructors.head.getParameters.head
22-
val accessor = vc.getClass.getMethods
22+
val accessor = vc.getClass.getMethods
2323
.filter(m => m.getName == constructorParam.getName || m.getName.endsWith("$$" + constructorParam.getName))
2424
.head
2525
accessor.setAccessible(true)

macro/src/main/scala/org/mockito/DoSomethingMacro.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ object DoSomethingMacro {
187187
if (pf.isDefinedAt(invocation))
188188
pf(invocation)
189189
else if (pf.isDefinedAt(invocation.children.last)) {
190-
val vals = invocation.children.dropRight(1)
190+
val vals = invocation.children.dropRight(1)
191191
val valsByName = vals.collect { case line @ q"$_ val $name:$_ = $value" =>
192192
name.toString -> (value.asInstanceOf[c.Tree], line)
193193
}.toMap
@@ -203,7 +203,7 @@ object DoSomethingMacro {
203203
q"$action.when($obj).$method[..$targs](...$newArgs)"
204204
}
205205

206-
val call = show(inlinedArgsCall)
206+
val call = show(inlinedArgsCall)
207207
val usedVals = valsByName.collect {
208208
case (name, (_, line)) if call.contains(name) => line
209209
}

0 commit comments

Comments
 (0)