Skip to content

Commit 1e49fbf

Browse files
authored
Drop EqMatchers_VersionSpecific (they aren't specific) (#575)
1 parent 08d5096 commit 1e49fbf

File tree

4 files changed

+11
-35
lines changed

4 files changed

+11
-35
lines changed

common/src/main/scala/org/mockito/matchers/EqMatchers.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package org.mockito
22
package matchers
33

4+
import org.mockito.internal.ValueClassExtractor
45
import org.mockito.{ ArgumentMatchers => JavaMatchers }
6+
import org.scalactic.{ Equality, Prettifier }
57

68
import scala.reflect.ClassTag
79

@@ -21,4 +23,13 @@ private[mockito] trait EqMatchers {
2123
* Delegates to <code>ArgumentMatchers.refEq()</code>, it's only here so we expose all the `ArgumentMatchers` on a single place
2224
*/
2325
def refEq[T](value: T, excludeFields: String*): T = JavaMatchers.refEq(value, excludeFields: _*)
26+
27+
/**
28+
* Creates a matcher that delegates on {{org.scalactic.Equality}} so you can always customise how the values are compared Also works with value classes
29+
*/
30+
def eqTo[T: Equality: ValueClassExtractor](value: T)(implicit $pt: Prettifier): T = {
31+
JavaMatchers.argThat(new EqTo[T](value))
32+
value
33+
}
34+
2435
}

core/src/main/scala-2.12/org/mockito/matchers/EqMatchers_VersionSpecific.scala

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

core/src/main/scala-2.13/org/mockito/matchers/EqMatchers_VersionSpecific.scala

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import org.mockito.matchers._
2525
trait ArgumentMatchersSugar
2626
extends AnyMatchers
2727
with EqMatchers
28-
with EqMatchers_VersionSpecific
2928
with ThatMatchers
3029
with StringThatMatchers
3130
with NullMatchers

0 commit comments

Comments
 (0)